Skip to content

Instantly share code, notes, and snippets.

View fuzzyalej's full-sized avatar
🎯
Focusing

Alejandro Andrés fuzzyalej

🎯
Focusing
View GitHub Profile
@rick
rick / custom_matchers.rb
Created November 2, 2008 22:26
thinking sphinx custom rspec matchers
module ThinkingSphinxIndexMatcher
class HaveIndex
def initialize(expected)
@expected = expected
end
def matches?(target)
@target = target
target.sphinx_indexes.collect(&:fields).flatten.collect(&:columns).flatten.collect(&:__name).include?(@expected)
end
# checkout: http://github.com/igrigorik/async-rails/
From bb2a78858cffa7c6937642986e9aca1a4f862c0d Mon Sep 17 00:00:00 2001
From: Ilya Grigorik <ilya@igvita.com>
Date: Thu, 10 Jun 2010 00:46:48 -0400
Subject: [PATCH] async rails3
---
Gemfile | 6 ++++++
app/controllers/widgets_controller.rb | 6 ++++++
@kyriacos
kyriacos / Gemfile
Created February 5, 2011 12:54 — forked from darkhelmet/Gemfile
gem 'resque', '>= 1.10.0'
gem 'heroku' # You will need the heroku gem for this too.
@mrflip
mrflip / auth_and_rate_limit.rb
Created May 11, 2011 06:59
API key authentication + rate limiting in Goliath using MongoDB (incomplete sketch)
#!/usr/bin/env ruby
$: << File.join(File.dirname(__FILE__), '../lib')
require 'goliath'
require 'em-mongo'
require 'em-http'
require 'em-synchrony/em-http'
require 'yajl/json_gem'
require 'goliath/synchrony/mongo_receiver' # has the aroundware logic for talking to mongodb
require File.join(File.dirname(__FILE__), 'auth_receiver')
@jasonrudolph
jasonrudolph / about.md
Last active May 14, 2024 16:36
Programming Achievements: How to Level Up as a Developer
@mjackson
mjackson / blocks.rb
Created August 11, 2011 18:30
Demonstrates the difference between Ruby's two different block styles.
def a(*args, &block)
puts "a got a block" if block_given?
end
def b(*args, &block)
puts "b got a block" if block_given?
end
# In this call, `b' is called with the block and the
# return value is given to `a' as an argument.
@madhums
madhums / Procfile.development
Created August 22, 2011 07:15
foreman and thinking sphinx
sphinx: bundle exec rake thinking_sphinx:run_in_foreground RAILS_ENV=development --trace
@metaskills
metaskills / wait_until.rb
Last active May 2, 2024 01:51
Never sleep() using Capybara!
# WAIT! Do consider that `wait` may not be needed. This article describes
# that reasoning. Please read it and make informed decisions.
# https://www.varvet.com/blog/why-wait_until-was-removed-from-capybara/
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations?
describe 'Modal' do
should 'display login errors' do
visit root_path
@werelax
werelax / test.rb
Created September 21, 2011 19:30
Serializing tag array in the model
# encoding: utf-8
require 'active_record'
require 'sqlite3'
ActiveRecord::Base.establish_connection(
:adapter => 'sqlite3',
:database => ':memory:'
)
@werelax
werelax / gist:1245128
Created September 27, 2011 14:09
Cool random strings in ruby
length = 12
rand(36**length).to_s(36)