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
# GIT | |
# create a new branch named <new_branch> and start it at origin/master | |
git-checkout -b <new_branch> origin/master | |
# continue on an existing branch | |
git-checkout origin/master | |
# Split a hunk for staging | |
git add --patch |
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
// Is hostname reachable ? | |
- (BOOL) isReachable:(NSString *)hostname | |
{ | |
SCNetworkConnectionFlags flags; | |
if (!SCNetworkCheckReachabilityByName([hostname cStringUsingEncoding:NSASCIIStringEncoding], &flags)) | |
return FALSE; | |
// If a connection is required, then it's not reachable | |
if (flags & (kSCNetworkFlagsConnectionRequired | kSCNetworkFlagsConnectionAutomatic | kSCNetworkFlagsInterventionRequired)) | |
return FALSE; |
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
# Install mysql adaptor for ruby 1.9 | |
gem install kwatch-mysql-ruby -- --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config | |
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
# jsquared: given an array with contents like ["47", 12, "hello"], | |
# how do I prefix each element with a given string and then join | |
# the elements together with another string? for example, something like | |
# ["47", 12, "hello"].join_with_prefix("+", "**") should give me +47**+12**+hello | |
array = ["47", 12, "hello"] | |
result = String.new() | |
array.each do | s | | |
s.join_with_prefix("+", "**") |
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
# Add the following lines to your geokit configuration | |
require "geocoder_maxmind_city.rb" | |
# This is your authorization key for MaxMind's geoip city web service. | |
# Paid alternative to the free hostip.info ip Geocoder | |
# See http://www.maxmind.com/app/web_services#country | |
# Set the value to the 12-digit key obtained from MaxMind. | |
Geokit::Geocoders::maxmind_city = 'REPLACE_WITH_YOUR_MAXMIND_KEY' | |
# Valid symbols are :ip,:geonames,:geo_plugin, and :maxmind_city. | |
# As before, make sure you read up on relevant Terms of Use for each |
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
# (MY CHANGES) | |
def self.geocode(address) | |
res = do_geocode(address) | |
return res ? res : GeoLoc.new | |
end | |
# (ORIGINAL - YOUR CHANGES) | |
def self.geocode(address) | |
res = do_geocode(address) | |
return res.success? ? res : GeoLoc.new |
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
export GEM_HOME=$HOME/.gem/ruby/active | |
export PATH=$HOME/.gem/ruby/active/bin:$PATH |
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
class Test::Unit::TestCase | |
# http://programblings.com/2008/10/31/two-shoulda-best-practices/ | |
# Sets the current person in the session from the person fixtures. | |
def self.logged_in_as(person, &block) | |
context "logged in as #{person}" do | |
setup do | |
@request.session[:person] = people(person).id | |
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
# chef-server as ssh tunnel (reverse-proxy) for Mac OS X 10.6 SL | |
# Based loosely on Readme.rdoc - http://github.com/opscode/chef/ | |
# port install CouchDB (may be broken on Snow Leopard) | |
sudo port install couchdb-devel | |
sudo launchctl load -w /Library/LaunchDaemons/org.apache.couchdb.plist | |
sudo launchctl unload -w /Library/LaunchDaemons/org.apache.couchdb.plist | |
# check for Trace/BPT trap error | |
couchdb | |
CTRL ^C |
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
janitors-Mac-mini:~ id$ sudo chef-client --config /etc/chef/client.rb --token 162a81fc9c30ade3e021ea084d72df29 -l debug | |
[Thu, 29 Oct 2009 22:33:09 +0000] INFO: Starting Chef Run | |
[Thu, 29 Oct 2009 22:33:09 +0000] DEBUG: Loading plugin os | |
[Thu, 29 Oct 2009 22:33:09 +0000] DEBUG: Loading plugin ruby | |
[Thu, 29 Oct 2009 22:33:09 +0000] DEBUG: Loading plugin languages | |
[Thu, 29 Oct 2009 22:33:11 +0000] DEBUG: Loading plugin kernel | |
[Thu, 29 Oct 2009 22:33:11 +0000] DEBUG: ---- Begin uname -s STDOUT ---- | |
[Thu, 29 Oct 2009 22:33:11 +0000] DEBUG: Darwin | |
[Thu, 29 Oct 2009 22:33:11 +0000] DEBUG: ---- End uname -s STDOUT ---- | |
[Thu, 29 Oct 2009 22:33:11 +0000] DEBUG: ---- Begin uname -s STDERR ---- |
OlderNewer