Giter Club home page Giter Club logo

squib-extensions's Introduction

Squib Extensions

Bonus functionality and shortcuts for working with squib.

Include in your squib project:

bundle install squib-extensions
require 'squib-extensions`

Google Sheet

gsheet allows you to load Deck data using Google Sheets.

First, share your sheet using File > Publish to the web

Select 'Entire document' and '.csv' as the format

Copy the URL like

https://docs.google.com/spreadsheets/d/e/2PACX-.../pub?output=csv
                                         ^^^^^^^^^

The code you need to pass is the long ID after /d/e.

If the sheet has multiple tabs, you can specify a later tab using the gid from the non-share URL like

https://docs.google.com/spreadsheets/d/.../edit#gid=123456
                                                    ^^^^^^

The gid is at the end of the URL after #gid=

usage:

deck = Squib.gsheet('2PACX-1..., 123456789)

Squib::Deck.new(cards: deck['name'].size, layout: ["deck.yml"]) do

Subset

Simplifies the format for taking a subset of rows and applying it to the range parameter.

Replace:

one_widget = {} ; data['widgets'].each_with_index{ |w, i| if w == 1  one_widget[w] = i end }
text range: one_widget, str: deck['widgets'], layout: 'widget_label'

with

one_widget = Squib.subset(deck['widgets'], -> (w) { w && w >= 1 })
text range: one_widget, str: deck['widgets'], layout: 'widget_label'

Avatars

Renders an avatar SVG image using using https://avatars.dicebear.com/. Uses the SVG-specified units and DPI to determine the pixel width and height. If neither data nor file are specified for a given card, this method does nothing.

usage:

avatar seed: deck['image'], library: 'avataaars', layout: 'person'

result (if your seed is Jack):

Card Number

Add the current card index to each card. Aids in locating the card in the CSV for making edits.

usage:

card_num x: 730, y: 1035

squib-extensions's People

Contributors

rnewton avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.