Skip to content

Instantly share code, notes, and snippets.

View sgharms's full-sized avatar

Steven G. Harms sgharms

View GitHub Profile
@sgharms
sgharms / gist:8943777
Created February 11, 2014 20:46
minitest ships with 2.0
➜ 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
irb(main):006:0>
Run options: --seed 10470
class TimeGreeter
def initialize(time = Time.now)
@time = time.hour
end
def greet
puts "At the tone, the time of day is #{hour_word}"
end
private
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
sgharms / gist:5b8fbf68b824643563b9
Created April 9, 2015 20:15
Handy git utilities
add_pr_remotes () {
mv .git/config .git/config-orig
awk '/remote "origin"/ {
print $0
getline;
print $0
getline;
print $0
print "\tfetch = +refs/pull/*/head:refs/remotes/origin/pr/*"
}1' .git/config-orig > .git/config
class User < ActiveRecord::Base
def key_is_valid?
...
end
end
# A "helper"
def user_key_is_valid?(user, params)
user.user_key == params[:user_key]
class AClassicPattern < ActiveRecord::Migration
def self.up
begin
try
rescue
raise ObiWan, "You're my only hope."
end
end
From a075b71833cec1b673b3ab3dd566cc83b902091a Mon Sep 17 00:00:00 2001
From: Steven G. Harms <sgharms@stevengharms.com>
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
$ 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
Buildfile: /Users/stharms/java_card/build.xml
clean:
[delete] Deleting directory /Users/stharms/java_card/classes
[delete] Deleting directory /Users/stharms/java_card/tests
init:
[mkdir] Created dir: /Users/stharms/java_card/classes
[mkdir] Created dir: /Users/stharms/java_card/tests
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