Skip to content

Instantly share code, notes, and snippets.

View topherfangio's full-sized avatar

Topher Fangio topherfangio

View GitHub Profile
@topherfangio
topherfangio / students.js
Created March 1, 2011 21:04
Basic code for creating a TemplateCollectionView
Pharos360.studentsController = SC.ArrayController.create(
/** @scope Pharos360.studentsController.prototype */ {
// TODO: Add your own code here.
}) ;
@topherfangio
topherfangio / test.handlebars
Created March 3, 2011 14:37
TemplateView with Handlebars
<h1>Test Handlebars Page</h1>
<p>
I really like {{ somevar }}!
</p>
@topherfangio
topherfangio / labels.js
Created March 6, 2011 14:56
Incorrect but Working Binding
Pharos360.labelsController = SC.ArrayController.create(
/** @scope Pharos360.labels.prototype */ {
// TODO: Add your own code here.
}) ;
Pharos360.NavigationView = SC.View.extend({
myTestBinding: 'Pharos360.labelsController.arrangedObjects',
myTestDidChange: function() {
console.log('myTest did change');
this.displayDidChange();
}.observes('myTest.[]'),
render: function(context) {
def create
if params[:member_id] and params[:title]
# Periods in a username will have been translated to underscores
member_id = params[:member_id].gsub('_', '.')
title = params[:title]
@member = Member.find(member_id)
@label = Label.new(:username => member_id, :title => title)
// Inside of Pharos360.studentsController, called whenever an element is clicked
this.set('content', Pharos360.store.find(Pharos360.Student));
// Inside my statechart
Pharos360.store.loadRecords(Pharos360.Student, students);
var students = Pharos360.store.find(Pharos360.Student);
Pharos360.studentsController.set('content', students);
@topherfangio
topherfangio / course.js
Created March 12, 2011 21:33
Problems with Associations
Pharos360.Course = SC.Record.extend(
/** @scope Pharos360.Course.prototype */ {
primaryKey: 'number',
number: SC.Record.attr(Number),
title: SC.Record.attr(String),
faculty_uid: SC.Record.attr(String),
credit_hours: SC.Record.attr(String),
days: SC.Record.attr(String),
@topherfangio
topherfangio / Console.js
Created March 24, 2011 17:01
Partially working example of using SC.TemplateView inside of an SC.ContainerView
// Run this in your console/code.
MyApp.mainPage.getPath('mainPane.containerView.testContainerView').set('nowShowing', "MyApp.testView");
You can also find all records of a certain type and all its subclasses:
<javascript>
allRecords = MyApp.store.find(SC.Record);
</javascript>
# Project: Pharos360
# Copyright: ©2011 My Company, Inc.
# ===========================================================================
# Add initial buildfile information here
config :core_360, :required => [ :sproutcore, :ki ]
config :pharos360, :required => [
:core_360,
'endash/table',
'shared',