Skip to content

Instantly share code, notes, and snippets.

View mattyoho's full-sized avatar

Matt Yoho mattyoho

  • Portland, OR, USA
View GitHub Profile
framework 'Cocoa'
# Documentation for delegates:
# http://developer.apple.com/mac/library/documentation/cocoa/reference/NSXMLParserDelegate_Protocol/Reference/Reference.html
class RSSParser
attr_accessor :parser, :xml_url, :doc
def initialize(xml_url)
@xml_url = xml_url
if [ "$1" ]; then
BRANCH=$1
else
BRANCH=$(git branch | grep '*' | cut -d ' ' -f2)
fi
REMOTE=$(git config --get branch.$BRANCH.remote)
REMOTE_BRANCH=$(git config --get branch.$BRANCH.merge)
echo "$REMOTE/${REMOTE_BRANCH##*/}"
development: &global_settings
database: textual_development
host: 127.0.0.1
port: 27017
test:
database: textual_test
<<: *global_settings
production:
development: &global_settings
database: textual_development
host: 127.0.0.1
port: 27017
test:
database: textual_test
<<: *global_settings
production:
# If your workers are inactive for a long period of time, they'll lose
# their MySQL connection.
#
# This hack ensures we re-connect whenever a connection is
# lost. Because, really. why not?
#
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar)
#
# From:
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/
#!/usr/bin/env ruby
puts "looking for the gems to upgrade..."
gem_info = Struct.new(:name, :version)
to_reinstall = []
Dir.glob('/Library/Ruby/Gems/**/*.bundle').map do |path|
path =~ /.*1.8\/gems\/(.*)-(.*?)\/.*/
name, version = $1, $2
bundle_info = `file path`
to_reinstall << gem_info.new(name, version) unless bundle_info =~ /bundle x86_64/
end
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@mattyoho
mattyoho / .gitconfig
Created December 4, 2009 19:56 — forked from kneath/._what.md
[alias]
up = !sh -c 'git pull && git log --pretty=format:"%Cred%ae %Creset- %C(yellow)%s %Creset(%ar)" HEAD@{1}..'
# solution provided by Eloy Duran
class API
def self.get(id)
new(with_response_data)
end
end
class APIWithIdentityMap < API
def self.map
# let's pretend we are not dealing with Rails, AR or even a DB
# controller
def index
@kids = Kid.fetch
end
# view
<ul>
<%- @kids.each do |kid| -%>