Skip to content

Instantly share code, notes, and snippets.

View bcardarella's full-sized avatar
Out sailing

Brian Cardarella bcardarella

Out sailing
View GitHub Profile
%{foo: foo, bar: bar} = some_map
{foo, bar} = some_map
defmodule BelongsToReferenceKeyTest do
use ExUnit.Case
defmodule Foo do
use Ecto.Model
@primary_key {:foobar_id, :id, []}
schema "foos" do
belongs_to :bar, Bar
getModelTypes: function() {
var namespaces = Ember.A(Ember.Namespace.NAMESPACES), types = Ember.A(), self = this;
Object.keys(window.require._eak_seen).reduce(function(previous, item, index, enumerable) {
var match;
if ((match = item.match(/app\/models\/(\w+)/)) && match[1]) {
previous.push(self.get('container').lookupFactory('model:' + match[1]));
}
This file has been truncated, but you can view the full file.
/*!
* @overview Ember - JavaScript Application Framework
* @copyright Copyright 2011-2014 Tilde Inc. and contributors
* Portions Copyright 2006-2011 Strobe Inc.
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
* @license Licensed under MIT license
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
* @version 1.4.0
*/
this.resource('posts');
// resolves to controllers/posts, templates/posts, routes/posts
this.resource('users', function() {
this.resource('posts');
// resolves to controllers/posts, templates/posts, routes/posts
});
def method_a
method_b do
thing = 'hey'
end
end
def method_b
thing = nil
yield
// This doesn't work because the method is always unique
Ember.run.debounce(this, function() {
// blah blah blah
}, 1000);
// This would run a comparison against target & "unique-id" rather than target & method
Ember.run.debounce(this, function() {
// blah blah blah
}, 1000, 'unique-id');
export default Ember.Handlebars.helpers('money', function(amount) {
return "$" + amount;
});
export default Ember.Handlebars.makeBoundHelper(function(amount) {
return "$" + amount;
});