Skip to content

Instantly share code, notes, and snippets.

View joshuaclayton's full-sized avatar

Josh Clayton joshuaclayton

View GitHub Profile
@joshuaclayton
joshuaclayton / post.rb
Created September 14, 2011 03:59 — forked from avdi/post.rb
Just a tease...
class Post
include FigLeaf
include ActiveModel::Validations
# ...
end
module Something
module Another
def self.great
puts "great was called"
end
end
end
include Something
@joshuaclayton
joshuaclayton / faststep_benchmark.out
Created March 15, 2011 04:18
Mongo ruby driver's benchmarks against faststep
Faststep -- Standard Benchmark
21-Mar-2011
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0]
Latest Commit:
commit 9c7c1b7b882d984fbc2840ae6d434af4e5e71cd6
Author: Joshua Clayton <[email protected]>
Date: Sun Mar 20 21:02:55 2011 -0400
5000 documents or queries per trial. Batches of 100 on batch inserts.
require 'formula'
class Vim <Formula
# Get stable versions from hg repo instead of downloading an increasing
# number of separate patches.
url 'https://vim.googlecode.com/hg/', :revision => '538cd32208'
version '7.3.011'
homepage 'http://www.vim.org/'
head 'https://vim.googlecode.com/hg/'
class FakeResque
cattr_accessor :queue
self.queue = []
def self.enqueue(klass, *args)
self.queue << [klass, args.to_json]
end
def self.run_jobs
while !self.queue.empty?
module Archives
module Callbacks
def self.included(base)
base.send :include, Archives::Callbacks::InstanceMethods
base.before_create :do_something_awesome
end
module InstanceMethods
private
@joshuaclayton
joshuaclayton / gist:721214
Created November 30, 2010 05:36
Homebrew-installed Python with pyobjc-core and pyobjc
I use Homebrew and wanted to install pip for mercurial. Pip requires a homebrew-installed version of Python, which is fine and dandy; however, I noticed that webkit2png was broken after I installed Python with Homebrew (it was missing pyobjc libs, which comes with the OS X Python install by default).
This assumes that the current homebrewed version of Python is 2.7.1 and that homebrew is set up for /usr/local. If that's not the case, you may have to change the minor version of setuptools (e.g. from 2.7 to 2.8) and change the PATH accordingly.
$ brew install python
Modify your PATH to include the path to Python's bin directory:
export PATH="/usr/local/Cellar/python/2.7.1/bin:/usr/local/bin:$PATH"
vim_colors "totallybogus" do
author "Josh Clayton <[email protected]>"
notes "This is something kinda crazy"
reset true
background :light
warn_on_column_count 80
normal "000", "F8F8FF"
vim_colors "totallybogus" do
author "Josh Clayton"
note "This is something kinda crazy"
reset true
background :light
normal :fg => "#000",
:bg => "#F8F8FF"
cursor :bg => "#445", :fg => "#F8F8FF" do
line :bg => "#D8D8DD"
module ApplicationHelper
def placeholdit(geometry, options = {})
base = "http://placehold.it/"
additional_options = []
if geometry =~ /\A\d+(x\d+)?\z/
additional_options << geometry
else
additional_options << 200