Skip to content

Instantly share code, notes, and snippets.

View erichocean's full-sized avatar

Erich Ocean erichocean

  • Xy Group Ltd
  • North Carolina
View GitHub Profile
@erichocean
erichocean / gist:997630
Created May 29, 2011 10:20
improved SC.TemplateView
SC.mixin(SC.TemplateView.prototype,
/** @scope SC.TemplateView.prototype */{
templateNameDidChange: function() {
SC.Logger.debug("Template name was set to " + this.get('templateName'));
this.rerender();
}.observes('template'),
/**
Called when the template property associated with this view changes.
@erichocean
erichocean / main.m
Created May 22, 2011 05:25 — forked from stuartcarnie/main.m
Demonstrates we can now support limited JIT compilation on recent versions of iOS (assuming Apple approves entitlements at some future point)
//
// main.m
// ProtectTest
// Demonstrates newer versions of iOS now support PROT_EXEC pages, for just-in-time compilation.
//
// Must be compiled with Thumb disabled
//
// Created by Stuart Carnie on 3/4/11.
// Copyright 2011 Manomio LLC. All rights reserved.
//
.rvmrc
abbot/
garcon/
tmp/
sc-docs/
.DS_Store
.project
*/.DS_Store
results/
server.log
@erichocean
erichocean / target_action.js
Created April 12, 2011 01:37
How to call an action on a target from your view.
/** @static
This mixin implements the basic target-action handling for a custom view.
@author Erich Ocean
*/
EO.TargetAction = {
/**
The name of the action you want triggered when performAction() is called.
@erichocean
erichocean / data_source.js
Created April 9, 2011 04:37
Shows how to load tab-delimited objects properties (newline separated).
/*global Timesheet */
Timesheet.datasource = SC.DataSource.create({
fetch: function(store, query) {
if (query.fetch) return query.fetch(store);
else return NO;
}
});
CohenTest.main = function main() {
// Step 1: Instantiate Your Views
// The default code here will make the mainPane for your application visible
// on screen. If you app gets any level of complexity, you will probably
// create multiple pages and panes.
CohenTest.getPath('mainPage.mainPane').append() ;
// Step 2. Set the content property on your primary controller.
// This will make your app come alive!
@erichocean
erichocean / now.ready.js
Created April 9, 2011 01:13
now.ready() is undefined
$(document).ready(function() {
now.ready(function() {
now.getVersion = function(callback) {
console.log('now.getVersion()');
callback(null, CohenTest.NAMESPACE);
};
});
});
var everyone = require("now").initialize(server.httpServer);
everyone.connected(function() {
var app = this.now;
console.log(app);
this.now.getVersion(function(version) {
console.log("version is "+version);
});
vows.describe('The Good Things').addBatch({
employees: SC.ScrollView.design({
layout: { top:74, width: 280, right: 10, bottom: 10 },
contentView: SC.ListView.design(SC.CollectionFastPath, {
contentBinding: 'Timesheet.employeesController.arrangedObjects',
selectionBinding: 'Timesheet.employeesController.selection',
exampleView: SC.View.extend(SC.ContentDisplay, {
contentDisplayProperties: 'fullName'.w(),
layerIsCacheable: YES,
@erichocean
erichocean / test-schema.js
Created April 5, 2011 11:46
How to test a JSON hash against a schema using the SC jsonschema framework
// ==========================================================================
// Project: Smartgraphs Learner Data Unit Test
// Copyright: ©2010 Concord Consortium
// Author: Erich Ocean <[email protected]>
// ==========================================================================
/*globals Smartgraphs module test ok equals same stop start setup teardown setupUserAndSessionFixtures JSV */
var env, schema;
module("Learner Data", {