This file contains 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
[alias] | |
st = status -s | |
co = checkout | |
cam = commit -a -m | |
cim = commit -m | |
aliases = "!git config -l | grep alias | cut -c 7-" | |
ria = "!git rebase -i `git merge-base HEAD master`" | |
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short | |
poh = pull --rebase origin master | |
mergetest = "!f(){ git merge --no-commit --no-ff \"$1\"; git merge --abort; echo \"Merge aborted\"; };f " |
This file contains 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
{ | |
"directory": "vendor/assets/bower_components" | |
} |
This file contains 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
# I see this a lot, and it is perfectly OK to do this | |
def new_cat(name, color) | |
cat = Cat.new | |
cat.name = name | |
cat.owner = self | |
cat.color = color | |
cat.save | |
end | |
# Here's another way to do that |
This file contains 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
hash = Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) } | |
hash["down"]["in-the"]["basement"] = "hello?" | |
hash | |
# => {"down"=>{"in-the"=>{"basement"=>"hello?"}}} | |
hash.has_key?("i-do-not") | |
# => false | |
hash.default = lambda{|h,k| h[k] = "bankai!" } # no longer a deeply nested/fun hash |
This file contains 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
# Allow for sortable lists in mongomapper | |
# fairly application specific but just to show an example... | |
module MongoMapper; module Plugins | |
module SortableQuestion | |
extend ActiveSupport::Concern | |
included do | |
key :position, Integer, :default => 1 | |
before_create :append_to_bottom_of_list | |
after_destroy :set_lower_sibling_positions |
This file contains 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
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776 | |
$ cd /usr/src | |
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz | |
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz | |
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz | |
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz | |
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz |
This file contains 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 'survey-gizmo-ruby' | |
# somewhere in your app define your survey gizmo login credentials. | |
SurveyGizmo.setup(:user => '[email protected]', :password => 'mypassword') | |
# get al resources | |
surveys = SurveyGizmo::API::Survey.all | |
questions = SurveyGizmo::API::Question.all(:survey_id => 12345) | |
# get a single resource |
This file contains 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
config.before(:each) do | |
repository(:default) do | |
transaction = DataMapper::Transaction.new(repository) | |
transaction.begin | |
repository.adapter.push_transaction(transaction) | |
end | |
end | |
config.after(:each) do | |
repository(:default).adapter.pop_transaction.rollback |
This file contains 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 'spec_helper' | |
require 'dm-core' | |
def create_dm_model(name) | |
DataMapper::Model.new(name) do | |
property :id, DataMapper::Property::Serial | |
property :name, DataMapper::Property::String | |
end | |
end |
This file contains 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
From 95c7e993f0c124f6fda4fce45452d63ede469fd3 Mon Sep 17 00:00:00 2001 | |
From: Kabari Hendrick <[email protected]> | |
Date: Wed, 22 Dec 2010 13:01:51 -0600 | |
Subject: [PATCH] git rid of strict dependency | |
Signed-off-by: Kabari Hendrick <[email protected]> | |
--- | |
Rakefile | 2 +- | |
1 files changed, 1 insertions(+), 1 deletions(-) |
NewerOlder