Skip to content

Instantly share code, notes, and snippets.

View etagwerker's full-sized avatar
🏠
Working from home

Ernesto Tagwerker etagwerker

🏠
Working from home
View GitHub Profile
def do_work
Resque::Scheduler.handle_delayed_items
Resque.queues.sort.each do |queue|
if job = Resque::Job.reserve(queue)
job.perform
end
end
end
@aeden
aeden / resque.rb
Created October 18, 2010 10:02
Place in features/support to make Resque workers execute immediately
Before do
module Resque
def self.enqueue(klass, *args)
klass.perform(*args)
end
end
end
@mgreenly
mgreenly / gist:1109325
Created July 27, 2011 13:11
database cleaner multiple connections single orm outside of rails
RSpec.configure do |config|
config.before(:suite) do
ActiveRecord::Base.establish_connection database['one']
DatabaseCleaner.strategy = :deletion
ActiveRecord::Base.establish_connection config.database['two']
DatabaseCleaner.strategy = :deletion
end
config.before(:each) do
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@jcasimir
jcasimir / exporter.rb
Created February 26, 2012 20:09 — forked from chad/exporter.rb
Export ActiveRecord Tables to CSV
require 'csv'
module Exporter
DEFAULT_EXPORT_TABLES = [ Invoice, InvoiceItem, Item, Merchant, Transaction, User ]
DESTINATION_FOLDER = "tmp/"
def self.included(klass)
klass.extend ClassLevelMethods
end
@fielding
fielding / config.ru
Created March 26, 2012 13:24
config.ru for node.js projects with pow
require "net/http"
class ProxyApp
def call(env)
begin
request = Rack::Request.new(env)
headers = {}
env.each do |key, value|
if key =~ /^http_(.*)/i
headers[$1] = value
@etagwerker
etagwerker / first-phase-world-cup-games.json
Created June 5, 2014 02:08
first-phase-world-cup-games.json
[{"group": "A", "number": "1", "time": "Thu Jun/12/14 17:00","local": "Brazil", "visitor": "Croatia", "city": "Arena de São Paulo, São Paulo", "timezone": "UTC-3"},
{"group": "A", "number": "2", "time": "Fri Jun/13/14 13:00","local": "Mexico", "visitor": "Cameroon", "city": "Estádio das Dunas, Natal", "timezone": "UTC-3"},
{"group": "A", "number": "17", "time": "Tue Jun/17/14 16:00","local": "Brazil", "visitor": "Mexico", "city": "Estádio Castelão, Fortaleza", "timezone": "UTC-3"},
{"group": "A", "number": "18", "time": "Wed Jun/18/14 18:00","local": "Cameroon", "visitor": "Croatia", "city": "Arena Amazônia, Manaus", "timezone": "UTC-4"},
{"group": "A", "number": "33", "time": "Mon Jun/23/14 17:00","local": "Cameroon", "visitor": "Brazil", "city": "Brasília", "timezone": "UTC-3"},
{"group": "A", "number": "34", "time": "Mon Jun/23/14 17:00","local": "Croatia", "visitor": "Mexico", "city": "Recife", "timezone": "UTC-3"},
{"group": "B", "number": "3", "time": "Fri Jun/13/14 16:00","local": "Spain", "visitor": "
@nocturnalgeek
nocturnalgeek / MailinatorAliases
Last active August 21, 2024 01:58
A list of alternate domains that point to @mailinator.com
@binkmail.com
@bobmail.info
@chammy.info
@devnullmail.com
@letthemeatspam.com
@mailinater.com
@mailinator.net
@mailinator2.com
@notmailinator.com
@reallymymail.com
@wvengen
wvengen / README.md
Last active September 27, 2024 11:07
Ruby memory analysis over time

Finding a Ruby memory leak using a time analysis

When developing a program in Ruby, you may sometimes encounter a memory leak. For a while now, Ruby has a facility to gather information about what objects are laying around: ObjectSpace.

There are several approaches one can take to debug a leak. This discusses a time-based approach, where a full memory dump is generated every, say, 5 minutes, during a time that the memory leak is showing up. Afterwards, one can look at all the objects, and find out which ones are staying around, causing the

@yeyewangwang
yeyewangwang / Freenode IRC.md
Created June 26, 2016 14:01
Freenode Nickserv Commands

Connect

/server chat.freenode.net

Nick