This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
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 <[email protected]> | |
Date: Thu, 10 Jun 2010 00:46:48 -0400 | |
Subject: [PATCH] async rails3 | |
--- | |
Gemfile | 6 ++++++ | |
app/controllers/widgets_controller.rb | 6 ++++++ |
gem 'resque', '>= 1.10.0' | |
gem 'heroku' # You will need the heroku gem for this too. |
#!/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') |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
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. |
sphinx: bundle exec rake thinking_sphinx:run_in_foreground RAILS_ENV=development --trace |
# 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 |
# encoding: utf-8 | |
require 'active_record' | |
require 'sqlite3' | |
ActiveRecord::Base.establish_connection( | |
:adapter => 'sqlite3', | |
:database => ':memory:' | |
) |
length = 12 | |
rand(36**length).to_s(36) |