Skip to content

Instantly share code, notes, and snippets.

View wagenet's full-sized avatar

Peter Wagenet wagenet

View GitHub Profile
@johnnyshields
johnnyshields / moped1x_instrumenter.rb
Created February 23, 2016 19:29
Monkey patch to instrument Moped 1.x same as 2.x.
# Monkey patch to instrument Moped 1.x same as 2.x.
# Can be removed after upgrading to Mongoid 4.
module Moped
module Instrumentable
class Noop
class << self
# Do not instrument anything.
this.resource("posts", { path: "/posts" }, function() {
this.resource("show", { path: "/:post_id" });
});
this.resource("posts", { path: "/posts" }, function() {
this.resource("post", { path: "/:post_id" });
});
this.resource("posts", { path: "/posts" });
this.resource("post", { path: "/posts/:post_id" });
@wagenet
wagenet / Gemfile
Created November 10, 2011 22:01
Static Hosting for Heroku
source :rubygems
gem 'rack-rewrite'
@wagenet
wagenet / routes_hack.js
Created October 21, 2010 16:24
Fix to allow SC.routes to set a currentLocation without triggering routing.
SC.routes.currentLocationDidChange = function(){
this.set('location', this.get('currentLocation'));
};
SC.routes.addObserver('currentLocation', SC.routes, 'currentLocationDidChange');
SC.routes.locationDidChange = function(){
var location = this.get('location'),
current = this.get('currentLocation');
if (location !== current) {
this.trigger();
@wagenet
wagenet / model.js
Created May 13, 2010 19:41
SproutCore Rails DataSource
MyApp.MyModel.mixin({
resourcePathFor: function(action, storeKey, item) {
var id, path;
id = storeKey ? MyApp.store.idFor(storeKey) : null;
switch(action) {
case 'fetch':
case 'create':
path = 'items';