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
window.ENV = window.ENV || {}; | |
window.ENV["EXPERIMENTAL_CONTROL_HELPER"] = true; |
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 = Ember.Application.create(); | |
App.Node = Ember.Object.extend({ | |
name: null, | |
children: [] | |
}); | |
App.TreeNodeView = Ember.View.extend({ | |
templateName: 'node-template', | |
classNameBindings: ['isOpen', 'hasChildren'] |
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
{ [ { id: "32111aae", spot_number: "BAH", commercials: [{ id: "33321eaz", title: "yar"}] } ] } | |
Binder.Spot = DS.Model.extend({ | |
spot_number: DS.attr('string') | |
}); | |
Binder.Commercial = DS.Model.extend({ | |
title: DS.attr('string'), | |
spot: DS.belongsTo(Binder.Spot) | |
}); |
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
var App = Ember.Application.create(); | |
App.Store = DS.Store.extend({ | |
revision: 11 | |
, adapter: YamAdapter.create() | |
}); | |
App.YamModel = DS.Model.extend({ | |
type: DS.attr('string') | |
, url: DS.attr('string') | |
, webUrl: DS.attr('string') | |
}); |
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
{ food: {_id: 'bc4', brand: 'test', food_nutrients: [{ _id: 'af1', name: 'sodium'}] } | |
FoodNutrient = DS.Model.extend({ | |
name: DS.attr( 'string' ) | |
}); | |
Food = DS.Model.extend( | |
brand: DS.attr( 'string' ), | |
food_nutrients: DS.hasMany( Diets.FoodNutrient ) | |
}); |
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
<?php | |
class Php53Traits { | |
public function __call($name, $params) { | |
if(!isset($this->{$name}) || !gettype($this->{$name}) == 'object') { | |
throw new Exception('not found'); | |
} | |
$tmp = $this->{$name}; | |
return call_user_func_array($tmp, $params); | |
} |
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
// If you're using an off-the-shelf adapter: | |
DS.RESTAdapter.map('Links.List', { | |
urls: { embedded: 'load' } | |
}); | |
// Otherwise: | |
App.MyAdapter = DS.RESTAdapter.extend({ | |
// ... |
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
String.prototype.persianThousandsSeparator = function () { | |
var val = this.toString(); | |
var x = val.split('.'); | |
var x1 = x[0]; | |
var x2 = x.length > 1 ? '.' + x[1] : ''; | |
var rgx = /(\d+)(\d{3})/; | |
while (rgx.test(x1)) { | |
x1 = x1.replace(rgx, '$1' + '٬' + '$2'); | |
} | |
return x1 + x2; |
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
addImages: (files) -> | |
formData = new FormData() | |
# Attach block id | |
formData.append "attachments[book_id]", @get('content.id') | |
# Loop through the FileList and render image files as thumbnails. | |
for file in files | |
# Only process image files. | |
if file.type.match("image.*") |
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.ApplicationController = Ember.Controller.extend(); | |
App.ApplicationView = Ember.View.extend({ | |
templateName: "application" | |
}); | |
App.DashboardController = Ember.Controller.extend(); | |
App.DashboardView = Ember.View.extend({ | |
templateName: "dashboard" | |
}); | |
App.AdministrationController = Ember.Controller.extend(); | |
App.AdministrationView = Ember.View.extend({ |