Just install this in your apps like so:
gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'
| #!/bin/sh | |
| ## | |
| # This is a script with usefull tips taken from: | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # | |
| # Run in interactive mode with: | |
| # $ sh -c "$(curl -sL https://raw.github.com/gist/2108403/hack.sh)" | |
| # | |
| # or run it without prompt questions: |
| # I created this because the headless webkit doesn't handle click/mouse events very well | |
| # so when using jquery events/binds like click/focus/mousedown etc... the tests weren't passing | |
| # because the javascript wasn't being executed because no mosue event was triggered | |
| # this gets around that and works just like fill_in | |
| def jquery_fill_in(selector, options) | |
| page.execute_script %Q{ | |
| $('body').focus; | |
| if((selector = $('##{selector}')).length || ($selector = $('label:contains(#{selector})').parent().find(':input')).length) { | |
| $selector.focus().click().val('#{options[:with]}').keydown(); | |
| } else { |
| module Helpers | |
| def sign_in(user) | |
| @user_session = UserSession.create user | |
| end | |
| def fill_in_autocomplete(selector, value) | |
| page.execute_script %Q{$('#{selector}').val('#{value}').keydown()} | |
| end | |
| def choose_autocomplete(text) |
| module Helpers | |
| def sign_in(user) | |
| @user_session = UserSession.create user | |
| end | |
| def fill_in_autocomplete(selector, value) | |
| page.execute_script %Q{$('#{selector}').val('#{value}').keydown()} | |
| end | |
| def choose_autocomplete(text) |
Just install this in your apps like so:
gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'
This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.
You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.
| // main app.js | |
| var client = require('ranger').createClient('ROOM', | |
| 'SECRET'); | |
| var timestamp = require('./timestamp').timestamp; | |
| var getWeatherWrapper = require('./weather').getWeatherWrapper; | |
| var showMap = require('./map').showMap; | |
| var getTweets = require('./tweets').getTweets; | |
| client.room(ROOMID, function(room) { |
| rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..' | |
| rails_env = ENV['RAILS_ENV'] || 'development' | |
| resque_config = YAML.load_file(rails_root + '/config/resque.yml') | |
| Resque.redis = resque_config[rails_env] | |
| #secure the admin view of resque | |
| Resque::Server.use(Rack::Auth::Basic) do |user, password| | |
| password == "secret" | |
| end |
| # Module Dependencies | |
| express = require 'express' | |
| app = module.exports = express.createServer(); | |
| # Configuration | |
| app.configure () -> | |
| app.set 'views', "#{__dirname}/views" | |
| app.set 'view engine', 'jade' |