Skip to content

Instantly share code, notes, and snippets.

View Chandler's full-sized avatar

Chandler Abraham Chandler

View GitHub Profile
@Chandler
Chandler / Hello World
Last active December 19, 2015 15:09
The actual very first program I ever wrote, my first week of college. CS112 "Computer Science for non majors"
/* hello.cpp
The Standard "hello world" program
Chandler Abraham August 25th, 2007
*/
# include <iostream>
using namespace std;
void showprogramHeader ();
##EDIT possible solution:
OrganizationsNewController = Em.ObjectController.extend
fields: Em.Object.create
name: '',
##Original Question:
#this works, I can bind to name
@resource 'organizations', path: "/orgs", ->
@resource 'show', path: ":organization_id", ->
@route 'settings'
visiting /orgs/17/settings renders 'settings' template into the outlet of the 'application' template.
I want it to render the templates into the outlets of the parents
settings -> show -> organizations -> application
OrganizationRoute = Em.Route.extend
model: (params) ->
Organization.find(params.organization_id)
#visiting /orgs/5/settings renders the "organization" template, and the "organziation.settings" template
#in the "organization" template and OrganizationController context, I have access to the model setup above.
#in the "organziations.settings" template and OrganiationSettingsController context I have no model
#scenario 1 /orgs/17/settings
OrganizationRoute = Em.Route.extend
model: (params) ->
model = Organization.find(params.organization_id)
@controllerFor('organizations').set 'selectedModel', model
OrganizationSettingsController = Em.Controller.extend
needs: 'organization'
organization: null
organizationBinding: 'controllers.organization'
Router.map ->
@resource 'organizations', path: "/orgs", ->
@resource 'organization', path: ":organization_id", ->
@route 'settings'
@route 'home'
#no OrganizationsRoute, skipping for now don't need the page for all orgs yet
OrganizationsController = Em.ArrayController.extend
selectedModel: null
@Chandler
Chandler / app.coffee
Created August 10, 2013 07:51 — forked from huafu/app.coffee
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
@Chandler
Chandler / gist:6302168
Created August 22, 2013 01:13
bad view pattern
App.MyController = Ember.Controller.extend
aSelected: false
bSelected: true
showA: ->
@set 'bSelected', false
@set 'aSelected', true
showB: ->
@set 'bSelected', true
@set 'aSelected', false
@Chandler
Chandler / gist:6359368
Last active December 21, 2015 20:09
password reset proposal

Currently there are two ways to login:

when logging in for the first time and pressing the sign in button:

    App.Auth.signin({
      email: '[email protected]'
      password: 'abc'
    })
  1. Makes a request
{{#if game.moreThanOnePlayer}}
  <span> it was true </span>
{{else}}
App.Game = DS.Model.extend
  players: DS.hasMany 'App.Player'
  moreThanOnePlayer: (->