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
import Ember from 'ember'; | |
/** | |
* @mixin WithStyleMixin | |
*/ | |
var WithStyleMixin = Ember.Mixin.create({ | |
concatenatedProperties: ['styleBindings'], | |
attributeBindings: ['style'], | |
/** |
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
logger = | |
_anonymousIndex: 0 | |
guessMethodName: (method) -> | |
unless (res = (->).toString.call(method).match(/function([^\(]*)/)[1].replace(/(^\s+|\s+)$/g, '')) | |
res = logger.autoNamespace() | |
res | |
autoNamespace: -> | |
"[anonymous##{ ++logger._anonymousIndex }]" |
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
import Ember from 'ember'; | |
import DS from 'ember-data'; | |
function hasOwn(o, p) { | |
return {}.hasOwnProperty.call(o, p); | |
} | |
function castId(r) { | |
return '' + (r && r instanceof DS.Model ? r.get('id') : r); | |
} |
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
import Ember from 'ember'; | |
var DAYS_IN_YEAR = 365.25; | |
var DAYS_IN_MONTH = DAYS_IN_YEAR / 12; | |
var MILLISECONDS_IN = { | |
millisecond: 1, | |
second: 1000, | |
minute: 1000 * 60, | |
hour: 1000 * 60 * 60, | |
day: 1000 * 60 * 60 * 24, |
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
isSame = (obj1, obj2) -> | |
if obj1 is obj2 | |
yes | |
else if obj1? and obj2? | |
if (t = typeof obj1) isnt typeof obj2 | |
no | |
else | |
if t isnt 'object' | |
no | |
else |
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
# force dates to be UTC | |
__timezoneOffset = (new Date).getTimezoneOffset() * 60 * 1000 | |
__dateWrapper = (original) -> | |
-> | |
unless @__hacked | |
@__hacked = yes | |
@setTime @getTime() - __timezoneOffset | |
try | |
res = original.apply @, arguments | |
catch err |
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
###* | |
Integration test module my composite stats show | |
### | |
class Test.MyCompositeStatsShowTest extends IntegrationTestSuite | |
# URL to load for ALL our tests | |
url: '/' | |
# Ajax mock groups to be used | |
ajaxMockGroupNames: ['basic'] | |
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 = require 'app' | |
###* | |
Controller ExampleItemsController | |
@class ExampleItemsController | |
@namespace App | |
@extends Ember.ArrayController | |
### | |
module.exports = App.ExampleItemsController = Ember.ArrayController.extend App.Mixins.PagedSearchableArrayController, |
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
EmBlog = Ember.Application.create({ | |
LOG_TRANSITIONS: true | |
}); | |
EmBlog.Comment = DS.Model.extend({ | |
body: DS.attr('string'), | |
post: DS.belongsTo('post') | |
}); | |
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 = Em.Application.create() | |
App.Router.map -> | |
@resource 'organizations', path: 'orgs', -> | |
@resource 'organization', path: ':organization_id', -> | |
@route 'index', path: '/' | |
@route 'settings' | |
# the route for all organizations | |
App.OrganizationsRoute = Em.Route.extend |
NewerOlder