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
// Trigger a modelChanged event on a model's collection if it has one | |
Backbone.Model.prototype.change = (function(original) { | |
return function(options) { | |
if (this.collection) { | |
this.collection.trigger("modelChange", this, options); | |
} | |
original.call(this, options); | |
}; | |
})(Backbone.Model.prototype.change); |
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.9.2-p290 |
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
namespace :deploy do | |
HEROKU_ACCOUNT = "account_name" | |
MAINLINE_BRANCH = "master" | |
STAGING_REPO = "app-name-staging" | |
PRODUCTION_REPO = "app-name-production" | |
def make_git_timestamp | |
"#{@env}-deploy-#{Time.now.to_s.gsub(/:/, "-").gsub(/\s/, "-").gsub(/--/, "-")}" | |
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
parse_git_branch() { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ →\ \1/' | |
} | |
export PS1='\u\[\e[1;37m\]@\[\e[1;32m\]\h\[\e[1;37m\]:\[\e[1;31m\]\W\[\e[1;33m\]$(parse_git_branch)\[\e[0;39m\]> ' | |
export PROMPT_COMMAND='echo -ne "\033]0;${PWD}\007"' |
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 Object | |
def try_all(*methods) | |
values = [self] | |
methods.each do |method| | |
value = values.last.try(method) | |
return nil if value.nil? | |
values << value | |
end | |
values.last |
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 proxy = function(source, eventName) { | |
var _self = this; | |
source.on(eventName, function(evt) { | |
var args = Array.prototype.slice.apply(arguments).splice(1); | |
args.unshift(evt); | |
_self.trigger.apply(_self, args); | |
}); | |
}; |
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 currentTimezoneOffset() { | |
var dstPeriod = { | |
2012: [new Date(2012, 2, 11), new Date(2012, 10, 4)], | |
2013: [new Date(2013, 2, 10), new Date(2013, 10, 3)], | |
2014: [new Date(2014, 2, 9), new Date(2014, 10, 2)], | |
2015: [new Date(2015, 2, 8), new Date(2015, 10, 1)], | |
2016: [new Date(2016, 2, 13), new Date(2016, 10, 6)], | |
2017: [new Date(2017, 2, 12), new Date(2017, 10, 5)], | |
2018: [new Date(2018, 2, 11), new Date(2018, 10, 4)], | |
2019: [new Date(2019, 2, 10), new Date(2019, 10, 3)], |
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
group :development do | |
gem 'ejs' | |
gem 'rb-fsevent' # optional | |
gem 'listen' | |
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
require "ejs" | |
class JstFilter < Rake::Pipeline::Filter | |
def initialize(output_filename=nil, &block) | |
block = proc { output_filename } | |
super(&block) | |
end | |
def generate_output(inputs, output) |
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
// This is a combination of two modified files from jQuery Mobile, | |
// jquery.mobile.vmouse.js and jquery.mobile.event.js | |
// They were modified to only provide the touch event shortcuts, and | |
// avoid the rest of the jQuery Mobile framework. | |
// The normal jQuery Mobile license applies. http://jquery.org/license | |
// | |
// This plugin is an experiment for abstracting away the touch and mouse | |
// events so that developers don't have to worry about which method of input | |
// the device their document is loaded on supports. | |
// |