- Support for delaying the lookup (good for preventing too many AJAX requests)
- Some fixes regarding the data fed to the onselect callback
For the proper source, and other examples, please see the original gist and the extended version
| #Model | |
| @user.should have(1).error_on(:username) # Checks whether there is an error in username | |
| @user.errors[:username].should include("can't be blank") # check for the error message | |
| #Rendering | |
| response.should render_template(:index) | |
| #Redirecting | |
| response.should redirect_to(movies_path) |
For the proper source, and other examples, please see the original gist and the extended version
| #!/usr/bin/env sh | |
| ## | |
| # This is script with usefull tips taken from: | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # | |
| # install it: | |
| # curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
| # |
| source :rubygems | |
| gem "sinatra", "~> 1.3.2" | |
| group :test do | |
| gem "minitest", "~> 2.10" | |
| gem "rack-test", "~> 0.6.1" | |
| gem "capybara", "~> 1.1" | |
| gem "capybara-webkit", "~> 0.11" | |
| gem "capybara_minitest_spec", "~> 0.2" |
| # Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key | |
| # that enables you to choose a character from a menu of options. If you are on Lion | |
| # try it by pressing and holding down 'e' in any app that uses the default NSTextField | |
| # for input. | |
| # | |
| # It's a nice feature and continues the blending of Mac OS X and iOS features. However, | |
| # it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode, | |
| # as it means you cannot press and hold h/j/k/l to move through your file. You have | |
| # to repeatedly press the keys to navigate. |
| #!/usr/bin/env ruby | |
| require 'benchmark' | |
| REGEXPS = [ | |
| /^no such file to load -- (.+)$/i, | |
| /^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i, | |
| /^Missing API definition file in (.+)$/i, | |
| /^cannot load such file -- (.+)$/i, | |
| ] |
| #!/bin/bash | |
| # node.js using PPA (for statsd) | |
| sudo apt-get install python-software-properties | |
| sudo apt-add-repository ppa:chris-lea/node.js | |
| sudo apt-get update | |
| sudo apt-get install nodejs npm | |
| # Install git to get statsd | |
| sudo apt-get install git |
| # Based off of https://gist.github.com/1115513 | |
| desc "Remote console on the production appserver" | |
| task :console, :roles => ENV['ROLE'] || :web do | |
| hostname = find_servers_for_task(current_task).first | |
| puts "Connecting to #{hostname}" | |
| exec "ssh -l #{user} #{hostname} -t 'source ~/.profile && cd #{current_path} && bundle exec rails c #{rails_env}'" | |
| end |
| This playbook has been removed as it is now very outdated. |
| # Usage: redis-cli publish message.achannel hello | |
| require 'sinatra' | |
| require 'redis' | |
| conns = Hash.new {|h, k| h[k] = [] } | |
| Thread.abort_on_exception = true | |
| get '/' do |