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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
Given /^There (?:is|are) (\d+|a) (.*?)(.*?)(?: with "(.*?)" for (.*?))?$/ do |count, model, factory_suffix, value, attribute| | |
count = 1 if count == "a" | |
factory_name = model.singularize << factory_suffix.gsub(" ", "_") | |
if attribute and value | |
count.to_i.times { Factory(factory_name.to_sym, attribute.to_sym => value) } | |
else | |
count.to_i.times { Factory(factory_name.to_sym) } | |
end | |
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
When /^I fill in the country for the degree with "(.*)"$/ do |value| | |
within("#degrees") do | |
fill_in("Country", value) | |
end | |
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
% script/generate model GrandParent name:string | |
exists app/models/ | |
exists test/unit/ | |
exists test/fixtures/ | |
create app/models/grand_parent.rb | |
create test/unit/grand_parent_test.rb | |
create test/fixtures/grand_parents.yml | |
create db/migrate | |
create db/migrate/20090127182616_create_grand_parents.rb | |
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
# http://henrik.nyh.se/2008/12/git-dirty-prompt | |
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/ | |
# username@Machine ~/dev/dir[master]$ # clean working directory | |
# username@Machine ~/dev/dir[master*]$ # dirty working directory | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(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
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'git' | |
log = "~/gitlog.txt" | |
tmp = "/tmp/gitlog" | |
commit = Git.open('.').log.first | |
message = [ | |
commit.date.strftime('%D'), |
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
require "net/http" | |
require "uri" | |
module Google | |
class Geocode | |
attr_accessor :address | |
attr_reader :key, :latutude, :longitude | |
def initialize( key, address ) | |
@key = key |