Skip to content

Instantly share code, notes, and snippets.

// Last commit: 9d6686c (2013-03-22 19:26:49 -0700)
(function() {
window.DS = Ember.Namespace.create({
// this one goes past 11
CURRENT_API_REVISION: 12
});
})();
@hashg
hashg / ember-bootstrap.js
Created March 15, 2013 06:48
Ember-bootstrap
(function() {
var Bootstrap = window.Bootstrap = Ember.Namespace.create();
})();
(function() {
var get = Ember.get;
var Bootstrap = window.Bootstrap;
{
"projects": [
{
"updated": null,
"name": "USA",
"created": null,
"is_active": true,
"persons": [
{
"updated": null,
@hashg
hashg / restless-custom.json
Created April 5, 2013 06:07
ember-flask-restless json
{
"blogs": [
{
"body": "Blah Blah Blah, is a song by American recording artist Kesha from her debut album, Animal.",
"author": "3OH!3",
"id": "2",
"comments": [
{
"blog_id": "2",
"desc": "Quest for Food",
@hashg
hashg / app.js
Created July 18, 2013 03:34
Ember Model
var App = window.App = Ember.Application.create();
App.Router.map(function () {
this.resource('projects', {path: '/projects'}, function(){
this.route('new');
this.resource('project', {path: '/:project_id'}, function(){
this.route('edit');
this.resource('members', {path: '/members'},function(){
this.route('add');
this.route('edit',{path: '/:member_id/edit'});
@hashg
hashg / PersonComputerModel.js
Created July 24, 2013 17:25
Ember Model : Person/Computers
var attr = Ember.attr, hasMany = Ember.hasMany, belongsTo = Ember.belongsTo;
var apiPrefix = '/api';
App.CustomAdapter = Ember.RESTAdapter.extend({
generateIdForRecord: function(record) {
var ch = "abcdefghiklmnopqrstuvwxyz"[Math.floor(25 * Math.random())];
return ch+'xxxyxxx'.replace(/[xy]/g, function(c) {
var r, v;
r = Math.random() * 16 | 0;
v = c === 'x' ? r : r & 0x3 | 0x8;
app/routes.js
function Routes() {
this.resource('register', {path: '/register'});
this.resource('login', {path: '/login'});
this.resource('logout', {path: '/logout'});
this.resource('projects', {path: '/projects'});
this.resource('projectsNew', {path: '/projects/new'});
this.resource('project', {path: '/projects/:project_id'});
this.resource('projectEdit', {path: '/projects/:project_id/edit'});
function Routes() {
this.resource('register', {path: '/register'});
this.resource('login', {path: '/login'});
this.resource('logout', {path: '/logout'});
this.resource('projects', {path: 'projects'}, function(){
this.route('new', {path: '/new'});
});
this.resource('project', {path: 'projects/:project_id'}, function(){
this.route('edit', {path: '/edit'});
@hashg
hashg / EM_belongsTo.js
Created September 8, 2013 17:28
Ember Model. Adding BelongsTo.
App.Person = Ember.Model.extend({
id: Ember.attr(),
name: Ember.attr(),
addresses: Ember.hasMany(App.Address, {key: 'addresses'})
});
App.Address = Ember.Model.extend({
id: Ember.attr(),
street: Ember.attr(),
person_id: Ember.attr(),
@hashg
hashg / index.html
Created November 20, 2013 01:33 — forked from bunkat/index.html
<!--
The MIT License (MIT)
Copyright (c) 2013 [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is