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
App.Cache = Em.Object.extend | |
init: -> | |
@store = App.__container__.lookup('store:main') | |
# tries to load the results from localforage cache or from normal adapter | |
findAll: -> | |
localforage.getItem(@modelStr).then (cacheItems)=> | |
if Em.isEmpty(cacheItems) | |
@findAndCache() | |
else |
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
App.PostsController = Em.ArrayController.extend({ | |
actions: { | |
create: function () { | |
// some validation logic here | |
return this.send('createPost'); | |
}, | |
save: function (model) { | |
// some validation logic here |
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
/* A éviter */ | |
function Customer () { | |
this.name = {}; | |
this.sendMessage = function () { }; | |
} | |
/* Recommandé */ | |
function Customer () { |
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
// service | |
angular | |
.module('app') | |
.service('logger', logger); | |
function logger () { | |
this.logError = function (msg) { | |
/* */ | |
}; | |
} |
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 computed; | |
App.computed = {}; | |
computed = Ember.computed; | |
App.computed.sample = function(dependentKey) { | |
return (computed("" + dependentKey + ".@each", function() { | |
var items, length; | |
items = this.getWithDefault(dependentKey, Em.A([])); |
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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
classNames: ['range-slider'], | |
value: 0, | |
attributeBindings: ['data-slider'], | |
'data-slider': 0, | |
valueDidChange: Em.observer('value', function(){ |
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
function saveItem(key, value) { | |
var json = JSON.stringify(value); | |
localStorage.setItem(key, json); | |
} | |
function loadItem(key) { | |
var json = localStorage.getItem(key); | |
return JSON.parse(json); | |
} |
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
export default Ember.Object.extend({ | |
previousUnauthorizedTransition: null, | |
token: localStorage.token, | |
username:null, | |
tokenChanged: function() { | |
localStorage.token = this.get('token'); | |
}.observes('token') | |
}) |
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 source: https://gist.github.com/oskarrough/914653b03d886c015320 | |
* Modified fork: https://gist.github.com/consideRatio/761c6286158e70feaed7 | |
* | |
* Working authentication with | |
* Firebase 2.0.x + Ember.js 1.8.1 + Ember Data Canary + EmberFire 1.3.0 + Ember CLI | |
* works for me! oskar@rough.dk | |
* | |
* Note: this assumes you've set up login on your Firebase, | |
* only handles Google and Facebook for now. | |
* |
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
// ---- | |
// Sass (v3.3.10) | |
// Compass (v1.0.0.alpha.20) | |
// ---- | |
// ----------------------------------------------------------------------------- | |
// Introduction | |
// ----------------------------------------------------------------------------- | |
// Here is hacky and experimental solution for cross-scopes extends |
OlderNewer