Skip to content

Instantly share code, notes, and snippets.

View trek's full-sized avatar
🏳️‍🌈

Trek Glowacki trek

🏳️‍🌈
View GitHub Profile
@chrisk
chrisk / cucumber_fakeweb_hook.rb
Created May 7, 2010 02:57
Using FakeWeb to stub out HTTP requests made by a server process from Cucumber's remote runners (Selenium, Mechanize, etc.)
# config/initializers/cucumber_fakeweb_hook.rb
# If this looks like a test server process, make its FakeWeb available to other
# processes via DRb. That way the test runner (which runs in a separate process)
# can dynamically register stubs for this server to use.
if Rails.env.cucumber? && defined?(PhusionPassenger)
require 'drb'
require 'fakeweb'
DRb.start_service("druby://localhost:30010", FakeWeb)
window.onload = function () {
if (! document.querySelectorAll) { // Quick & Dirty way to tell the good browsers from the bad ones.
alert("Please upgrade your browser to view this site.");
}
};
@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
@dhh
dhh / gist:981520
Created May 19, 2011 19:27
bulk api
# Bulk API design
#
# resources :posts
class PostsController < ActiveController::Base
# GET /posts/1,4,50,90
# post_url([ @post, @post ])
def show_many
@posts = Post.find(params[:ids])
end
@crofty
crofty / sproutcore_setup.mdown
Created June 15, 2011 20:17
Getting up and running with Sproutcore - 15/06/2011

Steps required for getting tests running

git clone git://github.com/sproutcore/sproutcore20.git
cd sproutcore20
echo "rvm use 1.9.2@sproutcore" > .rvmrc
cd -
cd sproutcore20
gem update --system 1.7.2
bundle install
gem uninstall spade # Version 0.1.0 isn't working for me yet
@dudleyf
dudleyf / AssetFile
Created January 4, 2012 00:46 — forked from nicholasjhenry/AssetFile
AssetFile for Rake Pipeline for use with ember.js/handlebars
require "json"
require "rake-pipeline-web-filters"
input "assets"
output "public"
class HandlebarsFilter < Rake::Pipeline::Filter
def initialize(&block)
block ||= proc { |input| input.sub(/\.handlebars$/, '.js') }
super(&block)
@garth
garth / Jakefile.js
Created January 16, 2012 18:37 — forked from wagenet/Assetfile.rb
Precompile .handlebars templates with Jake (nodejs)
var fs = require('fs')
var vm = require('vm')
var handlebarsjs = fs.readFileSync('path/to/handlebars.js', 'utf8')
var emberjs = fs.readFileSync('path/to/ember.js', 'utf8')
var templatesDir = 'path/to/template/dir'
desc('Compile all .handlebars templates')
task({ 'handlebars': [] }, function () {
process.stdout.write('Compiling .handlebars templates')
@jpoz
jpoz / upload_proxy.rb
Created February 12, 2012 23:20
Goliath File Upload Proxy Server
require 'goliath'
require 'em-synchrony/em-http'
class UploadProxy < Goliath::API
def on_headers(env, headers)
env.logger.info 'received headers: ' + headers.inspect
env['async-headers'] = headers
end
@zilkey
zilkey / ember-precompile.js
Created March 10, 2012 22:30 — forked from garth/Jakefile.js
Precompile .handlebars templates with node js
var fs = require('fs');
var vm = require('vm');
var emberjs = fs.readFileSync('public/javascripts/vendor/ember-0.9.5.min.js', 'utf8');
var templatesDir = 'templates';
var destinationDir = 'public/javascripts/templates';
function compileHandlebarsTemplate(templatesDir, fileName) {
var file = templatesDir + '/' + fileName;
@ghempton
ghempton / bound_helper.js
Created March 11, 2012 20:55
Ember Bound Handlebars Helper Utility
// This file contains utilities for creating bound helpers
// For reference: https://github.com/wagenet/ember.js/blob/ac66dcb8a1cbe91d736074441f853e0da474ee6e/packages/ember-handlebars/lib/views/bound_property_view.js
Ember.Handlebars.BoundHelperView = Ember.View.extend(Ember._Metamorph, {
context: null,
options: null,
property: null,
// paths of the property that are also observed
propertyPaths: [],