I hereby claim:
- I am melriffe on github.
- I am mriffe (https://keybase.io/mriffe) on keybase.
- I have a public key whose fingerprint is 969D 4A5E 57B6 ACF6 786E 4C99 B302 4828 6251 F6B9
To claim this, I am signing this object:
| #! /usr/local/bin/gst -f | |
| " | |
| This script is a way for me to get back into Smalltalk doing odd little tasks. | |
| $ gst /Users/mriffe/dev/play/dnd_games/dates.st | |
| $ gist -u https://gist.github.com/cfa53b8f6cd12f75f03d32075c49b82c dates.st | |
| " |
| Verifying that +mriffe is my blockchain ID. https://onename.com/mriffe |
I hereby claim:
To claim this, I am signing this object:
| # Simple class that lets you to define a custom ratio of when to let something | |
| # occur veruses not. | |
| # | |
| # Inspiration: We've all done the 'index % 5 == 0' to act as a gatekeeper to | |
| # some action, typically when creating test data. However, this works find when | |
| # you want a standard occurance rate: half the time, third of the time, 25% of | |
| # the time. I had a need to generate test data 40% (2 out 5) times. I'm not | |
| # smart enough to calculate a mod that would work for me. So I created a brute- | |
| # force method that included a variable, some checking, some incrementing, and | |
| # voila: 40% of the time I was able to create data. |
| #! /usr/bin/env ruby | |
| # Solution Spike, a down-n-dirty implementation of the desired functionality. | |
| require 'rubygems' | |
| require 'mechanize' # mechanize 2.4 | |
| target_directory = "#{ENV['HOME']}/Dropbox/Pragmatic Bookshelf/Magazines" # ruby 1.9 | |
| FileUtils.mkdir_p target_directory |
| Currently I have Kits and Items. A Kit can contain many Items; an Item can be associated to many Kits. | |
| I also have a join model, KitItem, that allows me to define how many of an Item is associated to a Kit. | |
| Here are the model definitions: | |
| class Kit < ActiveRecord::Base | |
| belongs_to :category | |
| has_many :kit_items, :dependent => :destroy | |
| has_many :items, :through => :kit_items | |
| end |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer