Skip to content

Instantly share code, notes, and snippets.

View geoffreyd's full-sized avatar

Geoffrey Donaldson geoffreyd

View GitHub Profile
Pharos360.Course = SC.Record.extend(
/** @scope Pharos360.Course.prototype */ {
primaryKey: 'number',
number: SC.Record.attr(Number),
title: SC.Record.attr(String),
credit_hours: SC.Record.attr(String),
days: SC.Record.attr(String),
start_time: SC.Record.attr(String),
@geoffreyd
geoffreyd / labels.js
Created March 7, 2011 00:50 — forked from topherfangio/labels.js
Connecting Array controller, Statechar and view
Pharos360.labelsController = SC.ArrayController.create(
/** @scope Pharos360.labels.prototype */ {
// TODO: Add your own code here.
}) ;
app.get('/move/:from/:to', function(req, res) {
console.log("Move");
// Define the 'board' parameter here.
board.load(function(board) {
from = req.params.from
to = req.params.to
// The scope of `this is far too finicky, it's always better to
// try another option if you can. In this case
res.send({removed: board.move(from, to)})
});
@geoffreyd
geoffreyd / core.js
Created October 26, 2010 08:35 — forked from jaehess/core.js
App = SC.Application.create(
/** @scope Chase.prototype */ {
NAMESPACE: 'App',
VERSION: '0.1.0',
// This is your application store. You will use this store to access all
// of your model data. You can also set a data source on this store to
// connect to a backend server. The default setup below connects the store
// to any fixtures you define.
//Is this correct?
SC.ImageView.design({
// You don't need to have both a 'right' and a 'width', just one or the other
layout: { top: 100, left: 840, rotate: 90, height: 150, width: 130 },
value: static_url('resources/aly.JPG'),
localize: NO,
mouseDown: function(evt) {
// This will hide the current image when clicked
this.set('isVisible', YES) ;
layoutView : SC.SplitView.design({
layoutDirection: SC.LAYOUT_HORIZONTAL,
defaultThickness: 200,
layout: {bottom:0, top:0, left:0, right:0},
canCollapseViews: NO,
// the left view...
topLeftView: SC.SplitView.design({
layoutDirection : SC.LAYOUT_VERTICAL,
defaultThickness: 200,
layout: {bottom:0, top:0, left:0, right:0},
compareObjects: function (v1, v2) {
var orderDefinition = [SC.T_ERROR, SC.T_UNDEFINED, SC.T_NULL, SC.T_BOOL, SC.T_NUMBER, SC.T_STRING, SC.T_ARRAY, SC.T_HASH, SC.T_OBJECT, SC.T_FUNCTION, SC.T_CLASS];
//function getType (v) {
// var t = typeof v;
// if (t == 'object') {
// if (t == null) return 'null';
// if (t instanceof Array) return 'array';
// }
#Ruby assignment option to assign unless nil
replacement_content = page_contents.content_label_find(item)
element.inner_html = replacement_content if replacement_content
# Should be able to do something like... not sure if the "=||" is the best suggestion for the assignment symbols
element.inner_html =|| page_contents.content_label_find(item)
def self.first_uninteresting
last = 0
Number.all(:order => "number").each do |n| # Number.find/all will return an enumerable, so you can each it directly.
return last + 1 if n.number.to_i != last + 1 # if's can be on the same line at the end for basic tests
last = n.number.to_i #ops forgot the number casting
end
last + 1 # Ruby will automatically return the last valuation, no need for 'return'
end
// ..........................................
// REFRESH
refreshRecords: function(records, options) {
if (!records || records.length == 0) return ;
if (!options) options = {} ;
records = records.byResourceURL() ; // group by resource.
for(var resource in records) {
if (resource == '*') continue ;