Skip to content

Instantly share code, notes, and snippets.

View bjeanes's full-sized avatar
🕊️

Bo Jeanes bjeanes

🕊️
View GitHub Profile
@bjeanes
bjeanes / environment.rb
Created October 1, 2008 02:18 — forked from mislav/_note.md
PostgreSQL version of GitConf to manage branched databases
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
require 'git_conf'
Rails::Initializer.run(:process, GitConf.new) do |config|
# ...
end
@bjeanes
bjeanes / gist:38889
Created December 22, 2008 04:41 — forked from drnic/gist:38843
# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
module BlahPlugin
VERSION = '1.0.0'
class << self
# add plugin to AR only if it hasn't been included before,
# which may cause stack-level-too-deep errors if you're aliasing methods
#
def enable_activerecord
return if ActiveRecord::Base.respond_to? :acts_as_blah
ActiveRecord::Base.extend BlahPlugin::Macro
@bjeanes
bjeanes / snippet.sh
Created January 16, 2009 23:29 — forked from drnic/snippet.sh
function parse_git_deleted {
[[ $(git status | grep deleted:) != "" ]] && echo "-"
}
function parse_git_added {
[[ $(git status | grep "Untracked files:") != "" ]] && echo '+'
}
function parse_git_modified {
[[ $(git status | grep modified:) != "" ]] && echo "*"
}
function parse_git_dirty {
There are many like it.
#!/usr/bin/env ruby
require 'rubygems'
require 'daemons'
Daemons.run_proc('PassengerMonitor') do
command = 'sudo passenger-memory-stats'
memory_limit = 250
When /^(.*) in the "([^\"]*)" section$/ do |action, title|
within "//*[(h1|h2|h3|h4|h5|h6|legend|caption)/descendant-or-self::*[contains(text(), '#{title}')]]" do
When action
end
end
When /^(.*) in the "([^\"]*)" row$/ do |action, title|
within "//*[(th|td)/descendant-or-self::*[contains(text(), '#{title}')]]" do
When action
end
@bjeanes
bjeanes / example_its_lets.rb
Created November 21, 2011 14:50 — forked from richievos/1-before_spec.rb
Spectastrophe #1
# This assumes `is_appropriate?` is renamed to `appropriate?` which is more idiomatic anyway
describe FashionSituation do
describe "#is_appropriate?" do
context "when wearing only shorts" do
let(:wearing_only_shorts) { FashionSituation.new(:shirt => false, :shoes => false, :shorts => true, :location => location) }
subject { wearing_only_shorts }
context "at a restaurant" do
let(:location) { "restaurant" }
window.app = format: {}
app.format.DollarizesCents = ->
dollarize: (pennies) ->
amount = (pennies / 100.0).toFixed(2)
"$#{@commasFor(amount)}"
#private
commasFor: (dollars) ->
@bjeanes
bjeanes / 4bo.clj
Created August 29, 2012 21:03 — forked from gfredericks/4bo.clj
4Bo
(defn loud-numbers
[]
(take 10 (iterate (fn [x] (println "I'm adding to " x) (inc x)) 0)))
(defn less-lazy
([coll] (less-lazy coll 1)
([coll how-far]
(lazy-seq
(future (nth coll how-far))
(cons (first coll) (less-lazy (rest coll))))))