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
App.WidgetRoute = Ember.Route.extend({ | |
model: function(params) { | |
return Ember.RSVP.hash({ | |
widget: this.store.find('widget' params.id), | |
cogs: App.MyCustomAjax() | |
}) | |
}, | |
setupController: function (controller, rsvp) { | |
controller.set('model', rsvp.widget); |
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
moduleFor('controller:application', 'Application controller'); | |
test('it has access to the currentUser object', function() { | |
var controller = this.subject(); | |
Ember.run(function() { | |
var user = controller.get('currentUser'); | |
ok(user, "User should exist but doesn't"); | |
}); | |
}); |
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
Ember.Application.initializer({ | |
name: 'currentUser', | |
initialize: function(container, application) { | |
var user = App.User.create({}); | |
container.optionsForType('user', { instantiate: false, singleton: true }); | |
container.register('type:user', 'current', user); | |
} | |
}); |
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
App.RaceResultRoute = Ember.Route.extend({ | |
model: function(params) { | |
return this.store.find('raceResult', params.race_result_id); | |
}, | |
setupController: function(controller, model) { | |
this.store.find('raceEvent').then(function(events) { | |
controller.set('raceEvents', events); | |
}); | |
} |
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
App.RaceLap = DS.Model.extend({ | |
race_results: DS.belongsTo('race_result') | |
}); | |
App.RaceResult = DS.Model.extend({ | |
race_laps: DS.hasMany('race_lap') | |
}); | |
DS.RESTAdapter.reopen({ | |
namespace: 'api/v1' |
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
Error: Sprockets::Rails::Helper::AssetFilteredError: Asset filtered out and will not be served: add `Rails.application.config.assets.precompile += %w( teaspoon.css )` to `config/initializers/assets.rb` and restart your server |
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
def foo | |
myblock = Proc.new | |
myblock.call | |
end | |
foo do | |
puts "ZOMG" | |
end | |
"ZOMG" | |
=> nil |
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
# Start an HTTP server from a directory, optionally specifying the port | |
function server() { | |
local port="${1:-8000}" | |
open "http://localhost:${port}/" | |
# Set the default Content-Type to `text/plain` instead of `application/octet-stream` | |
# And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files) | |
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port" | |
} |
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
build_package_combined_patch() { | |
local package_name="$1" | |
{ | |
curl https://github.com/ruby/ruby/pull/47.diff | git apply | |
curl https://raw.github.com/gist/1859082/performance_and_backport_gc.patch | patch -p1 | |
autoconf | |
./configure --prefix="$PREFIX_PATH" --enable-shared $CONFIGURE_OPTS | |
make -j 8 | |
make install |
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
{ | |
"current_page":1, | |
"total_pages":1, | |
"per_page":50, | |
"forms":[ | |
{ | |
"id":"4f9ab1bf21c79826c600001e", | |
"name":"Park Mantinence", | |
"description":"Form for inspection of park's state of maintenance.", | |
"created_at":"2012-04-27T14:48:31Z", |