Skip to content

Instantly share code, notes, and snippets.

View jasonm's full-sized avatar

Jason Morrison jasonm

View GitHub Profile
Backbone.Collection.prototype._addWithIdCheck = function(model, options) {
var idAttribute = model.idAttribute || this.model.prototype.idAttribute;
var modelId = model[idAttribute];
if (this.get(modelId) === undefined) {
this._addWithoutIdCheck(model, options);
}
};
Backbone.Collection.prototype._addWithoutIdCheck = Backbone.Collection.prototype._add;
# Original to_json.rb
$ cat ~/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.1.0.rc6/lib/active_support/core_ext/object/to_json.rb
# Hack to load json gem first so we can overwrite its to_json.
begin
require 'json'
rescue LoadError
end
# The JSON gem adds a few modules to Ruby core classes containing :to_json definition, overwriting
" http://stackoverflow.com/questions/762515/vim-remap-key-to-toggle-line-numbering
" source: http://stackoverflow.com/questions/4387210/vim-how-to-map-two-tasks-under-one-shortcut-key
let g:relativenumber = 0
set nonumber
set relativenumber
function! ToggleRelativeNumber()
if g:relativenumber == 0
let g:relativenumber = 1
set number
@jasonm
jasonm / gist:1161101
Created August 21, 2011 20:19
Links from #rcne 2011 backbone.js on rails fireside chat
Backbone.js on Rails @ #rcne2011
jason.p.morrison@gmail.com
http://twitter.com/jayunit
Nick Gauthier's presentation from Baltimore.rb
https://github.com/ngauthier/backbone-presentation
http://ngauthier-backbone.heroku.com/
Rails 3.1 backbone generators
When I create a task "Something you forgot but then did today"
And time moves forward 1 day
When I am on the tasks page
And I complete the task "Something you<Completion Command>"
iStockphoto Support -- Ticket ID: 775845
iStockphoto to me
show details 9/17/10
--
Issue/Question:
>> This is just a reminder from us at iStockphoto that your iStock credits will be expiring soon.
Aren\'t expiring credits illegal in several states? See the Skype class action lawsuit regarding expiring credits.
@jasonm
jasonm / gist:939199
Created April 24, 2011 01:11
Investigating browser support for compile-to-JS languages (line:line mappings, debugging, etc)
Where is the work/proposal going on to support debugging compile-to-JS langs in browser?
How can we move this forward?
I'm specifically interested in CoffeeScript.
Coffeescript Issue 558
line number mapping for debug
https://github.com/jashkenas/coffee-script/issues/558
Last login: Sun Aug 15 00:20:04 on console
Now using ruby 1.8.6 p383
[~] rvm install maglev-24067
<w> ruby ruby-1.8.7-p248 is not installed. </w>
<i> Installing Ruby from source to: /Users/jasonmorrison/.rvm/rubies/ruby-1.8.7-p248 </i>
module Enumerable
def recmap(&block)
self.map do |item|
if item.is_a?(Enumerable)
item.recmap(&block)
else
yield item
end
end
end
@jasonm
jasonm / after_restart.rb
Created May 24, 2010 14:46 — forked from jfernandez/after_restart.rb
Notify Hoptoad of deploys to Engine Yard Cloud
hoptoad_deploy_environments = %w(staging production)
if hoptoad_deploy_environments.include?(@configuration[:environment])
# Notify Hoptoad of deploy
run "cd #{release_path} && rake hoptoad:deploy TO=#{@configuration[:environment]} REVISION=#{@configuration[:revision]} REPO=#{@configuration[:repository]}"
end