This file contains 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
#original attribution https://gist.github.com/alexspeller/6251054 | |
bound = (fnName) -> Ember.computed fnName -> @get(fnName).bind(@) | |
App.ClickElsewhereMixin = Ember.Mixin.create | |
#use this method hook to define your desired behavior | |
onClickElsewhere: Ember.K | |
#bound version of our instance method |
This file contains 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
AR.AgentrunPickadateComponent = Ember.Component.extend | |
events: [ | |
'onOpen', | |
'onClose', | |
'onRender', | |
'onStart', | |
'onStop', | |
'onSet' | |
] |
This file contains 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
wrapWithProperty = (arrayName, propertyName, value) -> | |
Ember.computed arrayName + ".[]", -> | |
@get(arrayName).map( (each) -> | |
eachHash = {} | |
eachHash[propertyName] = value | |
eachHash.content = each | |
Ember.ObjectProxy.create(eachHash) | |
) | |
wrapWithHash = (arrayName, hashName) -> |
This file contains 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
model: function (params) { | |
var FetchPromise = Ember.RSVP.Promise(function (resolve, reject) { | |
Ember.RSVP.hash({ | |
dinosaurs: App.Dinosaur.find(), | |
ninjas: App.Ninja.find() | |
}) | |
.then(function (objects) { | |
resolve(objects); | |
}) |
This file contains 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
<div class="row"> | |
<ol class="breadcrumb"> | |
<li>{{#link-to "videos"}}Videos{{/link-to}}</li> | |
</ol> | |
</div> | |
<div class="media"> | |
<div class="media-header"> | |
<h3>{{title}}</h3> | |
<h4>{{description}}</h4> | |
<h5>Published on: {{publication_date}}</h5> |
This file contains 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
/** | |
first arg is a function, second is the number of arguments | |
to expect before executing | |
(N.B. The second arg is optional and will default to the arity | |
of the function if not provided) | |
*/ | |
function curry (fn, numArgs) { | |
var numArgs = numArgs || fn.length; | |
This file contains 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
var routeManaged = false; | |
var HashRoutePlugin = { | |
getCurrentRoute: function() { | |
return window.location.hash; | |
}, | |
pushCurrentRoute: function(newRoute) { | |
window.location.hash = newRoute; | |
}, | |
setCurrentRoute: function(newRoute) { |
This file contains 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
var rr = new RouteRecognizer | |
//this is currently used | |
rr.add([ | |
{path: "whatever", handler: whateverHandler} | |
]); | |
//when recognize is run, it will return this | |
[{handler: whateverHandler, params: {}}] |
This file contains 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
//Object -> Node -- constructor | |
let Node = (hash) => { | |
this.id = hash.id || new UUID() | |
this.value = hash | |
this.parentId = null | |
this.childIds = [] | |
} | |
//-> Graph -- constructor | |
let Graph = () => { |
This file contains 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 gist is just a quick example of the same function written | |
in a composable manner (using prodash.js). Please understand | |
that the functions exported by prodash are almost ALL curried | |
by default allowing them to be partially applied. | |
The goal of this code is to iterate through a list of "particles" | |
and return a Float32Array of their x,y,z components. Only living | |
particles should be included. | |
*/ |