Install (copy & paste):
curl -sL raw.github.com/gist/1676577/travis.rb > ~/bin/travis \
&& chmod +x ~/bin/travis
gem install hub | tail -2
ruby -e 'require "json"' 2>/dev/null || gem install json| =begin | |
| endless.rb is a pre-processor for ruby which allows you to use python-ish | |
| indentation to delimit scopes, instead of having to type 'end' every time. | |
| Basically, this makes the end keyword optional. If you leave off the | |
| end, the preprocessor inserts an end for you at the next line indented | |
| at or below the level of indentation of the line which started the scope. | |
| End is optional, so you can still write things like this: | |
| begin |
| jQuery(function() { | |
| $.cookie('tz', (new Date()).getTimezoneOffset()); | |
| }); |
| // ---------------------------------------------------------- | |
| // A short snippet for detecting versions of IE in JavaScript | |
| // without resorting to user-agent sniffing | |
| // ---------------------------------------------------------- | |
| // If you're not in IE (or IE version is less than 5) then: | |
| // ie === undefined | |
| // If you're in IE (>=5) then you can determine which version: | |
| // ie === 7; // IE7 | |
| // Thus, to detect IE: | |
| // if (ie) {} |
| #!/bin/bash | |
| codebranch="develop" | |
| docbranch="gh-pages" | |
| projectname=$(pwd | sed "s/^.*\///g") | |
| docdirectory="Documentation" | |
| defaultcommitmessage="Update documentation." | |
| # Switches to the codebranch | |
| # Generates the documentation to /tmp/gitappledoc/ | |
| # Switches to the docbranch |
| #!/usr/bin/env python | |
| # Reflects the requests from HTTP methods GET, POST, PUT, and DELETE | |
| # Written by Nathan Hamiel (2010) | |
| from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler | |
| from optparse import OptionParser | |
| class RequestHandler(BaseHTTPRequestHandler): | |
| def do_GET(self): |
| // Usage example: | |
| // input image: http://f.cl.ly/items/3v0S3w2B3N0p3e0I082d/Image%202011.07.22%2011:29:25%20PM.png | |
| // | |
| // UIImage *buttonImage = [UIImage ipMaskedImageNamed:@"UIButtonBarAction.png" color:[UIColor redColor]]; | |
| // .h | |
| @interface UIImage (IPImageUtils) | |
| + (UIImage *)ipMaskedImageNamed:(NSString *)name color:(UIColor *)color; | |
| @end |
| # encoding: UTF-8 | |
| Capistrano::Configuration.instance(:must_exist).load do | |
| namespace :rails do | |
| desc "Open the rails console on one of the remote servers" | |
| task :console, :roles => :app do | |
| hostname = find_servers_for_task(current_task).first | |
| exec "ssh -l #{user} #{hostname} -t 'source ~/.profile && #{current_path}/script/rails c #{rails_env}'" | |
| end | |
| end |
| class Api::RegistrationsController < Api::BaseController | |
| respond_to :json | |
| def create | |
| user = User.new(params[:user]) | |
| if user.save | |
| render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
| return | |
| else |
| # Put this file under Rails.root /lib | |
| class CssColourValidator < ActiveModel::EachValidator | |
| def validate_each(record, attribute, value) | |
| return false unless value | |
| record.errors[attribute] << (options[:message] || 'is not a valid CSS colour') unless ::HexadecimalColourValidator.matches?(value) or ::WebSafeColourValidator.matches?(value) | |
| end | |
| end |