Skip to content

Instantly share code, notes, and snippets.

@tomdale
tomdale / store.js
Created March 24, 2014 22:16
Microdata store
function buildRecord(type, data, store) {
var containerKey = 'model:' + type;
var factory = store.container.lookupFactory(containerKey);
var record = factory.create({
id: data.id,
$data: data
});

Keybase proof

I hereby claim:

  • I am tomdale on github.
  • I am tomdale (https://keybase.io/tomdale) on keybase.
  • I have a public key whose fingerprint is 2E8C 3BCE D5D0 939C 86AB 1B2E 2B57 2943 FC4D A5BF

To claim this, I am signing this object:

/*!
handlebars v2.0.0-alpha.2
Copyright (C) 2011-2014 by Yehuda Katz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@tomdale
tomdale / logger.js
Last active August 29, 2015 14:02
Excerpt of the formatted, hierarchical logger in Skylight
/*
Example usage:
import logger from "app/system/logger";
var LOG = logger.loggerFor("topic"');
LOG.log({
event: "data received",
secondary: {
resource: "photo",
@tomdale
tomdale / test.js
Created July 15, 2014 01:54
Example component test from Skylight
// from https://www.skylight.io
import Ember from "ember";
import { test, moduleForComponent } from 'ember-qunit';
import Util from "app/system/util";
var run = Ember.run;
moduleForComponent("billing-trial-status", "billing-trial-status component", {
needs: [
@tomdale
tomdale / gist:7d17530c12dbc104b15d
Created November 15, 2014 20:05
destructuring assignment example
// before
var displayAnnotation = config.displayAnnotation,
width = config.width,
axisHeight = config.axisHeight,
barsLeftMargin = config.barsLeftMargin,
barsRightMargin = config.barsRightMargin;
// after
var { displayAnnotation,
@tomdale
tomdale / gist:ad71ff9bf1227b687510
Created June 5, 2015 02:29
Shell function to start IR Hydra
irhydra () {
cd ~/irhydra
command rm -f *.cfg *.asm
command "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary" --no-sandbox \
--js-flags="--trace-hydrogen \
--trace-phase=Z \
--trace-deopt \
--code-comments \
--hydrogen-track-positions \
--redirect-code-traces"
// ==========================================================================
// Project: Currencyconverter.converterController
// Copyright: ©2009 My Company, Inc.
// ==========================================================================
/*globals Currencyconverter */
/** @class
Converts one form of currency to another.
// 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 April 23, 2011 20:12
How to override a label view render delegate
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,