This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
Read the db/schema.rb file and churn out a .DOT file containing | |
tables and linkages for *all* tables, not just the ones that | |
have ActiveRecord models. Guess that columns ending in _id are | |
links to other tables; assume all relations are one-to-many. | |
BACKGROUND | |
I'm working with a schema that is shared by a Rails app and a C++ app. | |
Some tables are only accessed by the C++ code and have no need to be | |
represented in the Rails models. A side-effect of this is that a tool |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
My brother created a C++ app for parsing cal files (not calendars) | |
and outputting the final matching data as a CSV. This is my attempt | |
in Ruby. | |
Expected incoming format: some text files that match the regexp's in | |
the list (e.g. "value=123") | |
Expected output: CSV format, ordered according to the columns array. | |
=end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I just realized how easy it is to create a | |
# shuffled deck of cards. | |
# (and to create a gist - thanks github!) | |
def shuffled_deck | |
suits = %w[Hearts Clubs Diamonds Spades] | |
pips = %w[2 3 4 5 6 7 8 9 10 | |
Jack Queen King Ace] | |
deck = suits.collect do |s| | |
pips.collect {|p| "#{p} of #{s}" } |
NewerOlder