Skip to content

Instantly share code, notes, and snippets.

@felipeelias
felipeelias / posts.rb
Created October 3, 2011 18:23
Grouping posts by month concept
require 'date'
class Month
attr_accessor :year, :month
def initialize(year, month)
self.year = year
self.month = month
end
@felipeelias
felipeelias / .gitignore
Created April 29, 2011 01:24 — forked from fnando/rubygems_proxy.rb
Rack app for caching RubyGems files. Very useful in our build server that sometimes fails due to our network or rubygems.org timeout.
cache
module AuthenticationMatcher
class RequireAuthentication
def initialize(method, action, params, context)
@method = method
@action = action
@params = params
@context = context
end
def matches?(controller)
@felipeelias
felipeelias / tests.watchr.rb
Created April 28, 2010 01:21 — forked from boxedup/tests.watchr
Watchr autotest file
ENV["WATCHR"] = "1"
system 'clear'
def growl(message)
growlnotify = `which growlnotify`.chomp
title = "Watchr Test Results"
message.gsub! /\[[0-9]+?m/, ''
image = message.include?('0 failures, 0 errors') ? "~/.watchr_images/pass.png" : "~/.watchr_images/fail.png"
options = "-w -n Watchr --image '#{File.expand_path(image)}' -m '#{message}' '#{title}'"
system %(#{growlnotify} #{options} &)