This file contains hidden or 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
#!/bin/sh | |
branch=$(git branch 2>/dev/null | grep ^\*) | |
[ x$1 != x ] && tracking=$1 || tracking=${branch/* /} | |
git config branch.$tracking.remote origin | |
git config branch.$tracking.merge refs/heads/$tracking | |
echo "tracking origin/$tracking" |
This file contains hidden or 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
module WillPaginate | |
module ViewHelpers | |
def will_paginate_with_collection_check(*args) | |
# if args.first.respond_to?(:total_pages) doesn't work if using | |
# with a presenter, since the presenter probably uses method_missing to | |
# delegate method calls to the collection instance variable | |
if (args.first.total_pages rescue false) | |
will_paginate_without_collection_check(*args) | |
end |
This file contains hidden or 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
# 1) Point *.example.com in your DNS setup to your server. | |
# | |
# 2) Setup an Apache vhost to catch the star pointer: | |
# | |
# <VirtualHost *:80> | |
# ServerName *.example.com | |
# </VirtualHost> | |
# | |
# 3) Set the current account from the subdomain | |
class ApplicationController < ActionController::Base |
This file contains hidden or 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
(function($) { | |
var binder = function(e, dataKey, dataValue) { | |
var $this = $(this), | |
oldValue = $this.data(dataKey), | |
newValue = dataValue, | |
passed = { | |
attr: dataKey, | |
from: oldValue, | |
to: newValue | |
}; |
This file contains hidden or 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
// ==UserScript== | |
// @name JIRA Issue Dock Badge | |
// @namespace http://fluidapp.com | |
// @description Displays JIRA Issue within dock badge | |
// @author Josh Clayton | |
// ==/UserScript== | |
(function () { | |
if (window.fluid) { | |
window.fluid.dockBadge = window.document.title.match(/\[.(\w{3,4}\-\d+)]/)[1].replace(/-/, ''); |
This file contains hidden or 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
// With Rails remote form helpers, the AJAX call is bound on the onsubmit attribute. | |
// Submitting that form via a framework (Prototype, jQuery, etc.) doesn't use the onsubmit | |
// attribute's Javascript because it was never explicitly bound. Is this really the only | |
// way to have a framework trigger the code nestled within the onsubmit attr? | |
$(document).ready(function() { | |
$("form").each(function() { | |
var self = $(this); | |
self.submit(function() { | |
new Function(self.attr("onsubmit"))(); |
This file contains hidden or 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
uniq: function() { | |
var resultArray = this.clone().sort(function(a,b) { if(a == b || JSON.stringify(a) == JSON.stringify(b)) { return 0; } if(a > b || JSON.stringify(a) > JSON.stringify(b)) { return 1; } return -1; }), | |
clone = this.clone(), | |
first = 0, | |
last = resultArray.length, | |
sorted = arguments[0] || false; | |
var unsort = function(sortedArray) { | |
var result = []; | |
var parsedSortedArray = $.map(sortedArray, function(i) { return JSON.stringify(i); }), |
This file contains hidden or 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
Webrat.configure do |config| | |
config.mode = :selenium | |
end | |
class Cucumber::Rails::World | |
def wait_for_ajax(timeout = 15000) | |
selenium.wait_for_condition "window.Ajax.activeRequestCount == 0", timeout | |
end | |
def wait_for_effects(timeout = 15000) |
This file contains hidden or 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 ActiveRecord::Base | |
def self.nullify(*args) | |
callback = args.shift if ActiveRecord::Callbacks::CALLBACKS.include?(args.first) | |
self.send(callback || "before_validation", lambda {|model| args.each {|a| model.send("#{a}=", nil) if model.send(a).blank? }}) | |
end | |
end |
This file contains hidden or 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
commit ed20f4dcc656ac55adbe9515466ef19d102e9ead | |
Author: Pratik Naik <[email protected]> | |
Date: Thu Mar 5 22:45:04 2009 +0000 | |
should_be_fucking_restful | |
diff --git a/lib/shoulda/action_controller.rb b/lib/shoulda/action_controller.rb | |
index 4719851..3723c72 100644 | |
--- a/lib/shoulda/action_controller.rb | |
+++ b/lib/shoulda/action_controller.rb |