Skip to content

Instantly share code, notes, and snippets.

View ColinCampbell's full-sized avatar

Colin Campbell ColinCampbell

View GitHub Profile
@ColinCampbell
ColinCampbell / test.js
Created March 12, 2010 19:55 — forked from enyo/test.js
components: SC.ScrollView.design({
layout: { top: 20, bottom: 10, left: 10, right: 10 },
contentView: SC.ListView.design({
content: [
{ name: 'test' },
{ name: 'test2' },
{ name: 'test3' },
MyApp.MyObject = SC.Object.extend({
property: value;
computedProperty: function(){
return this.get('property') === "foo";
}.property('property'),
setProperty: function(value){
this.set('property',value);
var stagger = 0;
var top = 25;
layer.append('<div class="markingLabel" style="width:125px;height:auto;position:absolute;left:' + Number(offset.left - 62.5) + 'px;top:' + Number(top+stagger) + 'px;color:#000000;">'+label+'</div>');
addFiniteObserver: function(key, target, method, context){
// normalize. if a function is passed to target, make it the method.
if (method === undefined) {
method = target; target = this ;
}
if (!target) target = this ;
if (typeof method === "string") method = target[method] ;
if (!method) throw "You must pass a method to addObserver()" ;
/**
An Accessory is an embeddable mini-application. It can have its own set of controllers,
states, and views. Accessories are useful pattern for building independent, reusable plugins
inside of your application.
*/
SC.Accessory = SC.Object.extend({
concatenatedProperties: 'automaticallyInitialize'.w(),
// FIXME: this name sucks

Proposed View-layer changes

Friday, Juan, Tom, Yehuda and I had a meeting where we discussed the renderer APIs and some ideas we had for the view layer. Here is what we came up with:

Overview

The purpose of these proposed changes is to lower the learning curve for users entering the SproutCore world and who are looking for quick feedback and an easy way to create custom views

@ColinCampbell
ColinCampbell / core.js
Created July 20, 2011 08:23 — forked from justinpeterman/core.js
Nested Records
Authoring = SC.Application.create(
store: SC.Store.create().from(SC.Record.fixtures)
}) ;
var matchersForFilter = function(properties) {
var attributes = util.keys(properties);
var attributesFilters = util.values(properties);
var arrayOfMatchersForAttribute = util.map(util.zip(attributes,
attributesFilters),
matchersForAttribute);
var matchers = util.flatten(arrayOfMatchersForAttribute, true);
return matchers;
var matchersForFilter = function(properties) {
var attributes = util.keys(properties);
var attributesFilters = util.values(properties);
var arrayOfMatchersForAttribute = util.map(
util.zip(attributes, attributesFilters), matchersForAttribute
);
var matchers = util.flatten(arrayOfMatchersForAttribute, true);
return matchers;