Skip to content

Instantly share code, notes, and snippets.

View Currencyconverter.converterController
// ==========================================================================
// Project: Currencyconverter.converterController
// Copyright: ©2009 My Company, Inc.
// ==========================================================================
/*globals Currencyconverter */
/** @class
Converts one form of currency to another.
View gist:337732
// dynamically apply a mixin specified in an object property
var MyClass = SC.Object.extend({
extraMixin: null,
foo: "bar",
init: function() {
arguments.callee.base.apply(this, arguments);
tomdale / gist:938930
Created Apr 23, 2011
How to override a label view render delegate
View gist:938930
layout: { centerX: 0, centerY: 0, width: 200, height: 18 },
tagName: "h1",
value: "Welcome to SproutCore!",
// Adds 'didClick' as a display property
displayProperties: ['didClick'],
didClick: NO,
View my_page.js
contentBinding: 'Authoring.reportTemplatesArrayController.content',
selectionBinding: 'Authoring.reportTemplatesArrayController.selection',
classNames: 'sc-list-item-view'.w(),
childViews: 'nameLabel'.w(),
Add 'sel' class in render method.
render: function(context) {
View bind_block.handlebars
MyApp.MyObj = SC.Object.extend({
type: "isString",
isString: function() {
return this.get('type') === 'isString';
{{#collection "App.FieldsView" tagName="ul"}}
{{#with content}}
View gist:1112528
testBoth('should fire observer that contains a path', function(get, set) {
var CarMixin = SC.Mixin.create({
acceleration: 0
var car = SC.mixin({}, CarMixin);
var tireAcceleration;
var TireMixin = SC.Mixin.create({
tomdale / gist:1134558
Created Aug 9, 2011
Load remote Handlebars templates
View gist:1134558
jQuery.get('/templates/foo.handlebars', function(data) {
var template = SC.Handlebars.compile(data);
SC.TEMPLATES['foo'] = template;
name: SC.attr 'string', { option: 'foo' }
View gist:1498364
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
%{$fg[green]%}%c \
%{$fg[red]%}%(!.#.»)%{$reset_color%} '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
RPS1='%{$fg[blue]%}%~%{$reset_color%} ${return_code} '
tomdale / example.html
Created Dec 27, 2011 — forked from tdreyno/example.html
Live collection example in Ember
View example.html
<!doctype html>
<html lang="en">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Collection Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">