Skip to content

Instantly share code, notes, and snippets.

View galtenberg's full-sized avatar

Christopher Galtenberg galtenberg

View GitHub Profile
@galtenberg
galtenberg / lkmake.rb
Created August 6, 2014 22:58
Creates Lkmake/Simplenote import-compatible json given plaintext file of notes separated by two blank lines
# Creates Lkmake/Simplenote import-compatible json given plaintext file of notes separated by two blank lines
# Author: Christopher Galtenberg
# License: Use it for good, however you like
# Input file:
# example note 1
#
# example note 2
# More "proper" than a miniskirt (http://gist.github.com/273579).
class Minidress
@@factories = {}
class << self
def define(name, &block)
@@factories[name.to_s] = block
end
def build(name, attrs = {})
new(name.to_s.classify.constantize.new, &@@factories[name.to_s]).record
# Factory girl, relaxed.
#
# Factory.define :user do |f|
# f.login 'johndoe%d' # Sequence.
# f.email '%{login}@example.com' # Interpolate.
# f.password f.password_confirmation('foobar') # Chain.
# end
#
# Factory.define :post do |f|
# f.user { Factory :user } # Blocks, if you must.
@galtenberg
galtenberg / gist:949680
Created April 30, 2011 13:46 — forked from mudge/gist:924909
Removing the jQuery Example plugin from operating on an element.
/* Let's say your element '#example' has already been bound
* with $('#example').example().
*/
/* This will get rid of the example immediately.
* Note that this will not return the original jQuery object so
* we can't chain anything onto this call.
*/
$('#example').triggerHandler('focus');
@galtenberg
galtenberg / RVM Git post-checkout hook
Created November 17, 2010 18:34
Switch rvm after git checkout
#!/bin/bash
#Filename: .git/hooks/post-checkout
#Note: make sure to chmod +x post-checkout
CURRENT=`git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\\ \1/'`
if [ $CURRENT = "upgrade" ]; then
rvm use r19
else
@galtenberg
galtenberg / gist:7586796
Created November 21, 2013 18:23
Current spec failures
1)
'NewRelicSso#initialize timestamp should == 1385054736' FAILED
expected: 1385054736,
got: 1357027200 (using ==)
/Users/nu_numina/dev/boxpanel/spec/lib/new_relic_sso_spec.rb:15:in `block (3 levels) in <top (required)>'
/Users/nu_numina/.rvm/gems/ruby-1.9.3-p385@boxpanel/bin/ruby_noexec_wrapper:14:in `eval'
/Users/nu_numina/.rvm/gems/ruby-1.9.3-p385@boxpanel/bin/ruby_noexec_wrapper:14:in `<main>'
2)
'UserHelper User Helper#login_person sets the authed_customer_id session variable to the first active_customers id' FAILED
$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'upstream/master'.
$ git pull -r
remote: Counting objects: 167, done.
remote: Compressing objects: 100% (114/114), done.
remote: Total 167 (delta 74), reused 12 (delta 12), pack-reused 41
Receiving objects: 100% (167/167), 58.66 KiB | 0 bytes/s, done.
Resolving deltas: 100% (81/81), completed with 11 local objects.