Skip to content

Instantly share code, notes, and snippets.

View sgharms's full-sized avatar

Steven G. Harms sgharms

View GitHub Profile
sgharms / gist:8943777
Created February 11, 2014 20:46
minitest ships with 2.0
View gist:8943777
➜ fu irb -r 'minitest/autorun'
irb(main):001:0> class TestClass < Minitest::Unit::TestCase
irb(main):002:1> def test_fu
irb(main):003:2> assert true, "should be true"
irb(main):004:2> end
irb(main):005:1> end
=> nil
Run options: --seed 10470
View time_greeter.rb
class TimeGreeter
def initialize(time =
@time = time.hour
def greet
puts "At the tone, the time of day is #{hour_word}"
View gist:d20a3c6176e22cb011e8
At the end of the 10th year of the Trojan war, the Trojans found the beach bare of Greeks and only a towering Horse left behind.
The beseiged went to behold the effigy and showed it to their wary priest of Neptune, Laocoon, who said:
"I distrust Argives -- especially those bearing gifts."
But the horse was borne into the city's walls for it was believed to be safe.
But Ulysses Most clever of all the Argive JavaScript programmers knew how to abuse open prototypes.
He created a setTimeout() to be run after dark
The horse blesses the Trojans, the tamers of horses
The horse blesses the Trojans, the tamers of horses
The horse blesses the Trojans, the tamers of horses
The horse blesses the Trojans, the tamers of horses
sgharms / gist:5b8fbf68b824643563b9
Created April 9, 2015 20:15
Handy git utilities
View gist:5b8fbf68b824643563b9
add_pr_remotes () {
mv .git/config .git/config-orig
awk '/remote "origin"/ {
print $0
print $0
print $0
print "\tfetch = +refs/pull/*/head:refs/remotes/origin/pr/*"
}1' .git/config-orig > .git/config
View z
class User < ActiveRecord::Base
def key_is_valid?
# A "helper"
def user_key_is_valid?(user, params)
user.user_key == params[:user_key]
View migration-down.rb
class AClassicPattern < ActiveRecord::Migration
def self.up
raise ObiWan, "You're my only hope."
View linguistics
From a075b71833cec1b673b3ab3dd566cc83b902091a Mon Sep 17 00:00:00 2001
From: Steven G. Harms <>
Date: Mon, 29 Jun 2009 02:11:59 -0500
Subject: [PATCH 01/11] s/independant/independent/g
README | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
mode change 100755 => 100644 README
View gist:281500
$ sudo gem search debug
*** LOCAL GEMS ***
ruby-debug (0.10.3)
ruby-debug-base (0.10.3)
ruby-debug-ide (0.4.9)
$ script/server -u
=> Booting Mongrel
View gist:427394
Buildfile: /Users/stharms/java_card/build.xml
[delete] Deleting directory /Users/stharms/java_card/classes
[delete] Deleting directory /Users/stharms/java_card/tests
[mkdir] Created dir: /Users/stharms/java_card/classes
[mkdir] Created dir: /Users/stharms/java_card/tests
View gist:428934
stharms@stharms-mac:~/java_card$ git status
# On branch anttune
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
# thedoug.txt
nothing added to commit but untracked files present (use "git add" to track)
stharms@stharms-mac:~/java_card$ ant
Buildfile: /Users/stharms/java_card/build.xml