Skip to content

Instantly share code, notes, and snippets.

View justinburdett's full-sized avatar

Justin Burdett justinburdett

View GitHub Profile
@justinburdett
justinburdett / keep-stringer-free.rb
Created January 2, 2014 04:49
Use this in your Heroku console to delete old stories from your Stringer RSS reader install when you approach the free 10,000 row limit in Heroku. It will delete all read, non-starred, non-keep unread stories from your reader. (Under normal circumstances, its never a good idea to delete data in a production setting.)
stories = Story.where(is_starred:false, is_read:true, keep_unread:false)
stories.each do |story| story.destroy end
@justinburdett
justinburdett / random-magic-cube.rb
Last active May 3, 2016 09:03
This Ruby script generates a random list of Magic: the Gathering cards, ideally for use in making a random Magic cube, and outputs the card list into a text file (suitable for importing into Magic Online or for use in bulk card shopping). For more information on cube drafting, see cubedrafting.com. You can modify the number of cards generated an…
require 'nokogiri'
require 'open-uri'
print "How many cards? "
CARDS_IN_CUBE = gets.strip.to_i
print "What format? "
LEGAL_IN_FORMAT = gets.strip
card_count = 1
# Create or open a text file in the same directory as this file and stores the card names there.