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() {
this.mixin(this.extraMixin);
arguments.callee.base.apply(this, arguments);
},
@tomdale
tomdale / gist:938930
Created Apr 23, 2011
How to override a label view render delegate
View gist:938930
labelView: SC.LabelView.design({
layout: { centerX: 0, centerY: 0, width: 200, height: 18 },
textAlign: SC.ALIGN_CENTER,
tagName: "h1",
value: "Welcome to SproutCore!",
// Adds 'didClick' as a display property
displayProperties: ['didClick'],
didClick: NO,
View my_page.js
contentView: SC.SourceListView.design({
contentBinding: 'Authoring.reportTemplatesArrayController.content',
selectionBinding: 'Authoring.reportTemplatesArrayController.selection',
exampleView: SC.View.design({
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';
}.property('type')
});
{{#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
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;
})
View a.coffee
SC.Object.extend
name: SC.attr 'string', { option: 'foo' }
View gist:1498364
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
PROMPT='
%{$fg[green]%}%c \
$(git_prompt_info)\
%{$fg[red]%}%(!.#.»)%{$reset_color%} '
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
RPS1='%{$fg[blue]%}%~%{$reset_color%} ${return_code} '
@tomdale
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">
<head>
<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">
</head>
<body>
You can’t perform that action at this time.