Skip to content

Instantly share code, notes, and snippets.

View johnbintz's full-sized avatar

John Bintz johnbintz

View GitHub Profile
@johnbintz
johnbintz / cards.rb
Last active December 18, 2015 13:49
Basic Ruby script for generating nanDECK cards (untested)
CARD_INFO = {
animal: { color: '#aa0000', border: '#ff0000' },
vegetable: { color: '#00aa00', border: '#00ff00' },
mineral: { color: '#0000aa', border: '#0000ff' }
}.freeze
data = [
{ name: 'Cat', value: '1', type: :animal },
{ name: 'Rutabaga', value: '2', type: :vegetable },
{ name: 'Obsidian', value: '3', type: :mineral }
@johnbintz
johnbintz / gist:5950149
Created July 8, 2013 16:07
Totally untested way to run Rack and a LiveReload listener for rack-livereload testing
LIVERELOAD_PORT = 50000
app = Rack::LiveReload.new(
lambda { |env|
[
200,
{ 'Content-Type' => 'text/html' },
[ <<-HTML ]
<html>
<head>
@johnbintz
johnbintz / cards.rb
Last active December 19, 2015 14:09
Basic Ruby script to create cards for nanDECK from Google Drive spreadsheet data
CARD_INFO = {
animal: { color: '#aa0000', border: '#ff0000' },
vegetable: { color: '#00aa00', border: '#00ff00' },
mineral: { color: '#0000aa', border: '#0000ff' }
}.freeze
# install this as a standalone gem
# or use a Gemfile and bundle exec with this script
require 'google_drive'
@johnbintz
johnbintz / Thorfile
Created July 23, 2013 02:36
Process a directory of PNG card files from nanDECK for The Game Crafter
require 'quick_magick'
class CardsBuilder < Thor
no_tasks do
def bordersize(image, color = image.get_pixel(0, 0))
image.gravity = 'center'
image.background = "rgb(#{color.join(',')})"
image.extent "825x1125"
end
end
@johnbintz
johnbintz / 01-original-jquery.coffee
Last active December 20, 2015 14:29
Going from pure jQuery to AngularJS
$(->
# set up or retrieve our local storage
navStatus = $.totalStorage('left_nav') || {}
# set up the initial state of each site opener and nav links
for id, status of navStatus
siteLink = $("#user_sites [data-id='#{id}']")
opener = siteLink.prev()
opener.toggleClass('open', status)
@johnbintz
johnbintz / gist:6382319
Last active December 21, 2015 23:29
Process a directory of images, color correcting for printout, for TGC use
# your source PNG files are in the input directory
mkdir -p output
for file in input/*.png; do
filename=${file##*/}
convert "${file}" -level "0%,100%,1.5" "output/${filename}"
# what the heck, make them smaller, too
class SearchController < ApplicationController
def index
@search = MultiSearch.new(params[:query])
# ... do things to @search maybe ...
# ... or hand it off to a decorator ...
end
end
@johnbintz
johnbintz / Cardfile.rb
Created November 17, 2013 18:10
Example Cardfile for SVGGVS
@session.configure do |c|
c.svg_source = "template.svg"
c.svg_merged_target = "merged-template.svg"
c.png_export_width = 825
c.pdf_dpi = 300
c.pdf_card_size = "750x1050"
c.individual_files_path = "svgout/output_%03d.svg"
@johnbintz
johnbintz / Cardfile.rb
Created November 18, 2013 12:38
Cardfile with added Animal Power layer display
@session.configure do |c|
c.svg_source = "template.svg"
c.svg_merged_target = "merged-template.svg"
c.png_export_width = 825
c.pdf_dpi = 300
c.pdf_card_size = "750x1050"
c.individual_files_path = "svgout/output_%03d.svg"
@johnbintz
johnbintz / Cardfile.rb
Last active December 28, 2015 20:19
Adding our new superpowers to our animals
@session.configure do |c|
c.svg_source = "template.svg"
c.svg_merged_target = "merged-template.svg"
c.png_export_width = 825
c.pdf_dpi = 300
c.pdf_card_size = "750x1050"
c.individual_files_path = "svgout/output_%03d.svg"