Skip to content

Instantly share code, notes, and snippets.

View ColinCampbell's full-sized avatar

Colin Campbell ColinCampbell

View GitHub Profile
sc_require('models/record');
App.Customer = App.Record.extend({
/**
Walk like a duck
@property {Boolean}
@default YES
@isReadOnly
@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' },
// ==========================================================================
// Project: SproutCore - JavaScript Application Framework
// Copyright: ©2006-2009 Sprout Systems, Inc. and contributors.
// Portions ©2008-2009 Apple Inc. All rights reserved.
// License: Licened under MIT license (see license.js)
// ==========================================================================
/** @class
@extends SC.Renderer
@since SproutCore 1.1
// ==========================================================================
// Project: SproutCore - JavaScript Application Framework
// Copyright: ©2006-2009 Sprout Systems, Inc. and contributors.
// Portions ©2008-2009 Apple Inc. All rights reserved.
// License: Licened under MIT license (see license.js)
// ==========================================================================
/** @class
@extends SC.Renderer
@since SproutCore 1.1
collectionViewShouldSelectIndexes: function(view, indexes) {
return indexes.filter(function(index) {
return view.get('content').objectAt(index).get('isFoo');
}
}
deleteVersion: function () {
var version = this.get('version'),
arrangedObjects = ContentManager.versionsController.get('arrangedObjects'),
idx = arrangedObjects.indexOf(version);
version.destroy();
version.commitRecord();
this.invokeLater(function () {
var object, test;
// start from the previous item
/* in views */
sc_require('renderers/custom_list_item_renderer');
MyApp.CustomListItem = SC.ListItemView.extend({
createRenderer: function(theme) {
var ret = theme.customListItem();
this.updateRenderer(ret);
return ret;
lessed.each_line {|line|
final += line.gsub(/url\('data:image\/(gif|png);base64,(.*?)'\)/) do |match|
"url('data:image/" + $1 + ";base64," + $2.gsub(" ", "+") + "')"
end
}
extend: function(ext) {
var ret = SC.mixin(SC.beget(this), ext),
key, value, cur;
for(key in ret) {
value = ret[key];
if (value instanceof Function && !value.superclass && (value !== (cur=this[key]))) {
value.superclass = value.base = cur;
}
}
MyApp.MyObject = SC.Object.extend({
property: value;
computedProperty: function(){
return this.get('property') === "foo";
}.property('property'),
setProperty: function(value){
this.set('property',value);