Skip to content

Instantly share code, notes, and snippets.

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) {
MyApp.MyObj = SC.Object.extend({
type: "isString",
isString: function() {
return this.get('type') === 'isString';
}.property('type')
});
{{#collection "App.FieldsView" tagName="ul"}}
{{#with content}}
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 August 9, 2011 16:53
Load remote Handlebars templates
jQuery.get('/templates/foo.handlebars', function(data) {
var template = SC.Handlebars.compile(data);
SC.TEMPLATES['foo'] = template;
})
SC.Object.extend
name: SC.attr 'string', { option: 'foo' }
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 December 27, 2011 18:16 — forked from tdreyno/example.html
Live collection example in Ember
<!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>
@tomdale
tomdale / gist:2481356
Created April 24, 2012 16:44
One CoffeeScript ambiguity
App.messageController = Ember.Object.create
message: "Hello, world!"
# Compiles to:
# App.messageController = Ember.Object.create({
# message: "Hello, world!"
# });
# Okay, let's refactor it and delete the message property:
@tomdale
tomdale / gist:4004913
Created November 2, 2012 23:10
Per-Type Adapters Proposal

Per-Type Adapter Hooks

Requirements

Many existing JSON APIs are not consistent between types. As JSON endpoints grew organically and were built by different engineers at different times, the style in which records are represented can vary wildly.

Historically, we have asked adapter authors to rely on the fact that the type of record is provided to all adapter hooks (either by passing a type argument, or by passing a record

@tomdale
tomdale / format-date.js
Created April 30, 2014 21:19
Date Handlebars helper
// app/helpers/format-date.js
export default Ember.Handlebars.makeBoundHelper(function(value, options) {
if (!value) { return; }
options = options.hash;
var m = moment(value);
var now = moment();