Skip to content

Instantly share code, notes, and snippets.

View andymeneely's full-sized avatar

Andy Meneely andymeneely

View GitHub Profile
@andymeneely
andymeneely / _references.rb
Created February 7, 2017 21:29
Squib example for referencing other cards
require 'squib'
# This makes use of Ruby's heredoc - it's just a string
data = Squib.csv data:(<<-CSV)
Name,Cost,Friend
Stringer,3,Avon
Avon,2,Stringer
CSV
Squib::Deck.new(cards: data.nrows, width: 300, height: 300) do
@andymeneely
andymeneely / json_to_excel.rb
Created February 1, 2017 21:51
Random json parsing script to convert to csv
require 'json'
require 'csv'
puts "Parsing..."
data = JSON.parse(File.read('LocationHistory.json'))
puts "Saving..."
CSV.open("locations.csv", "w+") do |csv|
headers = %w( timestampMs latitudeE7 longitudeE7 accuracy )
headers += (0..10).to_a.map { |i| "activity_#{i}" }
csv << headers
@andymeneely
andymeneely / pango_embed_drawing.rb
Last active April 30, 2018 05:16
Carve out arbitrary space inside of Pango text to draw on the surface.
require 'cairo'
require 'pango'
cxt = Cairo::Context.new(Cairo::ImageSurface.new(200,200))
puts "Our outer CR is: #{cxt.inspect}"
cxt.set_source_color('white')
cxt.paint
cxt.set_source_color('red')
extent_width = 200
@andymeneely
andymeneely / .gitignore
Last active April 12, 2016 04:03
Squib: demonstrating colors
_output/*
@andymeneely
andymeneely / .gitignore
Last active April 12, 2016 02:18
Squib: import data from xlsx or csv
_output/*
@andymeneely
andymeneely / .gitignore
Last active October 28, 2016 09:20
Squib: save stuff
_output/*
@andymeneely
andymeneely / .gitignore
Last active September 9, 2016 04:07
Squib: draw shapes
_output/*
@andymeneely
andymeneely / .gitignore
Last active April 12, 2016 00:42
Squib samples
_output/*
@andymeneely
andymeneely / .gitignore
Last active March 21, 2016 02:58
Squib sample: build groups
*.png