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
# Put this code in some file and require it at the beginning of your Gemfile | |
# Then you can list the groups to exclude from heroku. E.g: | |
# | |
# exclude_in_heroku :cucumber, :development, :test | |
# | |
# Based on this post by Matt Campbell: http://soupmatt.com/fixing-bundlewithout-on-heroku-cedar, | |
# which is based in an idea by @grosser. All the credits to them. | |
module Bundler | |
class Dsl | |
old_group = instance_method(:group) |
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 | |
script/killall | |
# Deletes trash files | |
rm -f tmp/*.oauth | |
rm -f log/*.log | |
rm -f db/schema.rb | |
rm -f tmp/evernote_session_data | |
rm -f rerun.txt |
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( $ ){ | |
$.fn.delayedKeyup = function(period, handler) { | |
var delayedHandler = (function() { | |
var timer = 0; | |
return function(callback, miliSeconds) { | |
clearTimeout(timer); | |
timer = setTimeout(callback, miliSeconds); | |
} | |
})(); |
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
var addBackboneSupportToJasminePrettyPrinter = function() { | |
var oldPrettyPrinterFormat = jasmine.PrettyPrinter.prototype.format; | |
jasmine.PrettyPrinter.prototype.format = function(value) { | |
var self = this; | |
if(value instanceof Backbone.Model){ | |
this.emitObject(value.attributes); | |
} | |
else if(value instanceof Backbone.Collection){ | |
value.each(function(model) { | |
self.emitScalar(model.cid); |
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
# Methods like "put_raw" will put the raw content in the request | |
[:put, :post].each do |verb| | |
define_method "#{verb}_raw" do |method, content| | |
request.stub!(:raw_post).and_return(content) | |
put method | |
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
toBeObjectWithProperties: function(expectedClass, expectedProperties) { | |
var isObjectWithProperties = (this.actual instanceof expectedClass); | |
for(var propertyName in expectedProperties){ | |
var expectedPropertyValue = expectedProperties[propertyName]; | |
isObjectWithProperties = isObjectWithProperties && (this.actual[propertyName] == expectedPropertyValue); | |
} | |
return isObjectWithProperties; | |
} |
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
$.expr[':'].focus = function(a){ | |
return (a == document.activeElement); | |
} | |
$(".:focus"); // The currently focused element |
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
jasmine.create$SpyObj = function(name, listOfSpyMethods) { | |
listOfSpyMethods = listOfSpyMethods || ['unbind', 'remove']; | |
return jQuery.extend($('<div/>'), jasmine.createSpyObj(name, listOfSpyMethods)); | |
}; |
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 ViewHelpers | |
def render_javascript_template(data) | |
render | |
include_javascript_files | |
yield do_render_javascript_template(data) | |
end | |
def include_javascript_files | |
%w{jquery.js pure.js}.each {|file| js("load('public/javascripts/#{file}');")} |