Skip to content

Instantly share code, notes, and snippets.

View sfsekaran's full-sized avatar

Sathya Sekaran sfsekaran

View GitHub Profile
@eric
eric / DISCLAIMER.md
Created March 28, 2011 22:59
Log directly to Papertrail or any remote syslog target from Heroku
@aeden
aeden / api_steps.rb
Created November 30, 2010 12:47
Steps for testing API endpoints with Cucumber
# Requires nokogiri and jsonpath
# Only works with rack test
World(Rack::Test::Methods)
# Feel free to customize this for whatever API auth scheme you use
Given /^I am a valid API user$/ do
user = Factory(:user)
authorize(user.email, user.password)
end
@robhurring
robhurring / app.rb
Created November 23, 2010 17:03
ActiveRecord query caching with Sinatra
# ActiveRecord refuses to enable query caching _unless_ you have the following setup
# 1) you _must_ use ActiveRecord::Base.configurations to store your auth details
# 2) you _must_ include the ActiveRecord::QueryCache middleware
# 3) you _must_ inherit from the _Base_ connection -- abstract models don't
# cache without a bit of hacking, it only query caches anything from AR::Base
require 'sinatra'
require 'active_record'
# query caching requires that you use AR::Base.configurations to store your
@netzpirat
netzpirat / 0_README.md
Created November 12, 2010 10:42
Continuous CoffeeScript testing with Guard and Jasmine

Continuous CoffeeScript testing with Guard and Jasmine

This Gist shows how to set up a Rails project to practice BDD with CoffeeScript, Guard and Jasmine. You can see this setup in action on Vimeo

  • Install Gems with Bundler with bundle install
  • Define your guards with mate Guardfile
  • Initialize Jasmine with bundle exec jasmine init
  • Configure Jasmine with mate spec/support/yasmine.ym
  • Start Guard with bundle exec guard
require "time"
require "date"
class Date
def to_time
Time.local(year, month, day)
end
end
class Time
@jlindsey
jlindsey / culerity.js
Created June 3, 2010 16:47
Using Cucumber/Capybara/Culerity, a step to wait until all AJAX calls are complete.
// this allows culerity to wait until all ajax requests have finished
jQuery(function($) {
var original_ajax = $.ajax;
var count_down = function(callback) {
return function() {
try {
if(callback) {
callback.apply(this, arguments);
};
} catch(e) {