Skip to content

Instantly share code, notes, and snippets.

View paulbjensen's full-sized avatar

Paul Jensen paulbjensen

View GitHub Profile
git :init
submodule = yes?("Do you love submodules?") ? true : false
[ ['rspec', 'git://github.com/dchelimsky/rspec.git'],
['rspec-rails', 'git://github.com/dchelimsky/rspec-rails.git'],
['resource_controller', 'git://github.com/giraffesoft/resource_controller.git'],
['cucumber', 'git://github.com/aslakhellesoy/cucumber.git'],
['paperclip', 'git://github.com/thoughtbot/paperclip.git'],
['exception_notifier', 'git://github.com/rails/exception_notification.git'],
['jrails', 'git://github.com/aaronchi/jrails.git']
run "haml --rails #{run "pwd"}"
User-agent: *
Disallow: /
str = '\243119'
str.toutf8
# you would expect it to display "119", but it returns:
# => "19 "
module Callbacks
def callbacks
@_callbacks ||= {}
end
def bind(callback_name, &block)
callbacks[callback_name] ||= []
callbacks[callback_name] << block
end
@paulbjensen
paulbjensen / error stacktrace
Created October 17, 2010 17:36
A bug I got when running a step in Aruba
Scenario: create (no shogun global config) # features/create.feature:6
Given a directory named "mycoolapp" # aruba-0.2.3/lib/aruba/cucumber.rb:62
And I cd to "mycoolapp" # aruba-0.2.3/lib/aruba/cucumber.rb:86
When I run "ruby ../../../bin/shogun create" interactively # aruba-0.2.3/lib/aruba/cucumber.rb:98
Then the output should contain "Please type in your api token: " # aruba-0.2.3/lib/aruba/cucumber.rb:106
And I type "32h23d9823dj9832d89" # aruba-0.2.3/lib/aruba/cucumber.rb:102
Broken pipe (Errno::EPIPE)
/Library/Ruby/Gems/1.8/gems/aruba-0.2.3/lib/aruba/api.rb:175:in `write'
/Library/Ruby/Gems/1.8/gems/aruba-0.2.3/lib/aruba/api.rb:175:in `write_interactive'
/Library/Ruby/Gems/1.8/gems/aruba-0.2.3/lib/aruba/cucumber.rb:103
require 'rubygems'
require 'steak'
require 'cucumber'
class Opinion
def self.give(topic, subjects)
case topic
when "which is better?"
if self.is_a_code_bastard?
@paulbjensen
paulbjensen / app.coffee
Created December 30, 2010 11:14
How I do global variables with CoffeeScript
# app.coffee
fs = require 'fs'
express = require 'express'
tasty = require './tasty.js'
app = express.createServer()
md = require("node-markdown").Markdown
firstArticleData = ''
articleList = []
fs.readdir 'articles', (err, files) ->
if [[ -s /Users/paulbjensen/.rvm/scripts/rvm ]] ; then source /Users/paulbjensen/.rvm/scripts/rvm ; fi
# Bundle Aliases
alias bi='bundle install'
alias be='bundle exec'
# Git Aliases
alias ga='git add'
alias grm='git rm'
@paulbjensen
paulbjensen / weirdDateBehaviour.js
Created January 7, 2011 17:44
Trying to setup a new Date() object is a pain in the ass!
// Stupid JavaScript Date inconsistency
//So, Say you have a string Date
var lastDayOf2010 = "2010-12-31";
var choppedLastDayOf2010 = lastDayOf2010.split('-');
// Let's say you decide to parse the date like so:
var badDate = new Date(