Skip to content

Instantly share code, notes, and snippets.

@gvarela
gvarela / .cook
Created November 29, 2010 20:03
default developer image
{
"imagemagick": {"ghostscript": true},
"redis": {"launchd": true},
"rbenv": {"versions": ["1.9.3-p194"]},
"basic_brew": {"formulae": [
"bash-completion",
"wget"
]},
"cookbooks": ["https://github.com/modeset/osx-cookbooks/tarball/master", "https://github.com/gvarela/osx-cookbooks-ext/tarball/master"],
@gvarela
gvarela / gist:640963
Created October 22, 2010 17:05 — forked from tmm1/gist:329682
require 'rubygems'
require 'eventmachine'
require 'em-http' # gem install em-http-request
require 'yajl' # gem install yajl-ruby
class String
def bold
"\033[1m#{self}\033[0m"
end
end
module IsContentChunk
def self.included(base)
base.class_eval do
named_scope :by_association, lambda{ |key| {:conditions => ['association = ?', key] } }
named_scope :regional_and_or_default, lambda{ |key| {
:include => [:region],
:conditions => ['association = ? AND ( region_id = ? OR region_id = ? )', key, self.current_region, Region.default],
:order => "FIELD(region_id, #{id_or_null( self.current_region )}, #{id_or_null( Region.default )})"
# == Schema Information
#
# Table name: geocode_results
#
# id :integer(4) not null, primary key
# query :string(255)
# address :string(255)
# lat :string(255)
# lng :string(255)
# created_at :datetime
#!/bin/sh
#
# This script starts and stops the Dj daemon
# This script belongs in /engineyard/bin/dj
#
PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
CURDIR=`pwd`
usage() {
echo "Usage: $0 <appname> {start|stop} enviroment [name maximum_priority minimum_priority]"
We couldn’t find that file to show.
class UrlEncodedPairParser < StringScanner #:nodoc:
attr_reader :top, :parent, :result
def initialize(pairs = [])
super('')
@result = {}
pairs.each { |key, value| parse(key, value) }
end
KEY_REGEXP = %r{([^\[\]=&]+)}
#!/usr/bin/env bash
if [ -d sphinx-0.9.8.1 ]; then
rm -rf sphinx-0.9.8.1
fi
if [ -e sphinx-0.9.8.1.tar.gz ]; then
rm sphinx-0.9.8.1.tar.gz
fi
curl -O http://www.sphinxsearch.com/downloads/sphinx-0.9.8.1.tar.gz
#!/usr/bin/env bash
cd $1 && \
find ./ -type f -name \geminstaller*.yml -exec sudo geminstaller -c {} \;