Skip to content

Instantly share code, notes, and snippets.

View melriffe's full-sized avatar
🦍
I may be slow to respond.

Mel Riffe melriffe

🦍
I may be slow to respond.
View GitHub Profile
@melriffe
melriffe / dates.st
Last active October 14, 2019 04:34
GNU Smalltalk script exploring dates and "2nd Saturday of the Month"
#! /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
"
@melriffe
melriffe / gist:ddfd7ce437ff4943b5ff
Last active October 11, 2019 15:18
blockchain ID
Verifying that +mriffe is my blockchain ID. https://onename.com/mriffe
@melriffe
melriffe / keybase.md
Last active October 11, 2019 15:20
keybase ID

Keybase proof

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:

@melriffe
melriffe / pass_failinator.rb
Created January 16, 2013 20:29
Need to do something in an odd, non-standard ratio of time? Say 13 out of 17 times? Use PassFailinator to accomplish this feat!
# 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.
@melriffe
melriffe / spike.rb
Created May 3, 2012 17:50
PragPubinator: Script to download PragPub Magazine into your Dropbox folder
#! /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
@melriffe
melriffe / gist:1911966
Created February 26, 2012 00:54
Notes on changing a Many-to-Many to a Self-Referential Many-to-Many
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
@melriffe
melriffe / about.md
Created August 9, 2011 14:05 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer