This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>currentDocument</key> | |
<string>public/javascripts/init.js</string> | |
<key>documents</key> | |
<array> | |
<dict> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
# Sets a flash message based on locale. | |
def set_flash(key, options = {}) | |
case key | |
when :notice, true | |
flash[:notice] = flash_message(:notice, options) | |
when :error, false | |
flash[:error] = flash_message(:error, options) | |
else | |
raise ArgumentError.new "Unrecognized flash key: #{key}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
remove_project_trailing_whitespace () { | |
for file in * (app|config|test|lib|public)/**/*.(rb|js|sass|css|yml|md|txt|erb|haml|config) | |
do | |
sed -i "" 's/[[:space:]]*$//' ${file} | |
sed -i "" -e :a -e '/^\n*$/N;/\n$/ba' ${file} | |
done | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
require 'yaml' | |
require 'term/ansicolor' | |
include Term::ANSIColor | |
# Usage: | |
# > rake test | bookmark # => Bookmark test output | |
# > bookmark 1 # => Open first failing test. | |
# > bookmark 2 # => Open second failing test. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# nil.get :blake # => nil | |
# some_obj.get :name, :length # => The value of some_obj.name.length or nil | |
class Object | |
def get(*properties) | |
object = self | |
properties.each do |property| | |
if object.respond_to?(property) | |
object = object.send(property) | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def assert_not(test, msg = (nomsg = true; nil)) | |
nomsg ? assert(!test) : assert(!test, msg) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<title>jQuery $this Test</title> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> | |
<script type="text/javascript"> | |
$(function(){ | |
$("#test1").click(function(){ | |
var t0 = new Date |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# features/support/env.rb | |
require 'webrat' | |
require 'webrat/core/matchers' | |
Webrat.configure do |config| | |
config.mode = :rack | |
config.open_error_files = false # Set to true if you want error pages to pop up in the browser | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime, sublime_plugin | |
import os | |
class DetectFileTypeCommand(sublime_plugin.EventListener): | |
""" Detects current file type if the file's extension isn't conclusive """ | |
""" Modified for Ruby on Rails and Sublime Text 2 """ | |
""" Original pastie here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa """ | |
def on_load(self, view): | |
filename = view.file_name() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in extension to object. | |
# | |
class Object | |
# Returns true if the object sent #in is included in the argument list. | |
# | |
# Usage in conditionals: | |
# | |
# if 1.in 1, 2, 3 | |
# puts "1 was included" | |
# end |