Skip to content

Instantly share code, notes, and snippets.

View benschwarz's full-sized avatar
🏁
Making the web fast

Ben Schwarz benschwarz

🏁
Making the web fast
View GitHub Profile
module Registerable
@@registered = {}
class NotRegistered < StandardError; end
def inherited(klass)
klass.send(:indentifier, klass.name.downcase.to_sym)
end
def for(id, &block)
class UserSession < Authlogic::Session::Base
class << self
# Proxy through to the user model for formtastic
def content_columns
User.content_columns
end
end
end
require 'rubygems'
require 'mustache'
class Template
def read
File.read("#{path}/my-template.mustache")
end
def path
"templates"

Smeg2, the OHM

  • Use best practices
  • Minimal magic
  • Elegant map/reduce/list management (with classes)
  • Point out the best tools for validation and hooks

Smoke, ƒor Gabe

You can use your joined twitter and delicious source via Smoke.stream.output. It will return an array of hashes in order of the publication date.

If you wanted to snap on a web service to your site, you could use smoke-rack.

Enjoy.

db/couch/
|-- cultureamp
`-- _design
`-- stream
|-- lists
| `-- statuses
| `-- list.js
`-- views
`-- statuses
`-- map.js

Watch, dirt simple mechanism to tell if files have changed

Pass Watch a Dir.glob friendly path and a block that you'd like to be executed when something changes

Watch.new("**/*") { puts "file added, removed or changed" }
class A
class << self
attr_writer :properties
def property(name)
(@properties||=[]) << name
end
def properties
properties = []
ancestors.map do |elder|
@benschwarz
benschwarz / README
Created January 19, 2010 13:32
A formula for home brew to install couchdb from head
CouchDB/HEAD/0.11b Homebrew recipe.
-- You will need to run `brew link icu4c` prior to running the couchdb install.
I've found `link` to not work under fish shell (it works under bash) so I'll
need to dig into homebrew source to get that right.
I'm just sharing it while I've got it ready.
Save this file to your/homebrew/path/Library/Formulas/couchdb-head
@benschwarz
benschwarz / gist:289453
Created January 29, 2010 04:40
Review commits from the last week
git config --global alias.lg "log --date=relative --since='1 week ago' --pretty -…
…-graph"