This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are many like it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'daemons' | |
Daemons.run_proc('PassengerMonitor') do | |
command = 'sudo passenger-memory-stats' | |
memory_limit = 250 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.app = format: {} | |
app.format.DollarizesCents = -> | |
dollarize: (pennies) -> | |
amount = (pennies / 100.0).toFixed(2) | |
"$#{@commasFor(amount)}" | |
#private | |
commasFor: (dollars) -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)))))) |
OlderNewer