Skip to content

Instantly share code, notes, and snippets.

View jhliberty's full-sized avatar
:octocat:
It's a rails kind of year

John-Henry Liberty jhliberty

:octocat:
It's a rails kind of year
View GitHub Profile
@jhliberty
jhliberty / apiary.md
Last active August 29, 2015 14:15 — forked from netmilk/apiary.md

FORMAT: X-1A

Machines API

The Example API for Dredd API Blueprint testing tool

Group Machines

Machines collection [/machines]

@jhliberty
jhliberty / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#connect resque web to different redis server
`resque-web ./resque-conn.rb`
#cat ./resque-conn.rb =>
Resque.redis = Redis.new(:host => “127.0.0.1”, :port => 6379, :db => 1)
DS.RESTSerializer.extend({
extractArray: function(store, type, payload) {
var inflector = Ember.Inflector.inflector,
data = payload || [],
modifiedPayload = {};
modifiedPayload[inflector.pluralize(type.typeKey)] = data;
return this._super(store, type, modifiedPayload);
}
/*
* This decorates Handlebars.js with the ability to load
* templates from an external source, with light caching.
*
* To render a template, pass a closure that will receive the
* template as a function parameter, eg,
* T.render('templateName', function(t) {
* $('#somediv').html( t() );
* });
* Source: https://github.com/wycats/handlebars.js/issues/82
###
# Namespace
###
Semantic = window.Semantic = Ember.Namespace.create
UI_DEBUG: false
UI_PERFORMANCE: false
UI_VERBOSE: false
###
# Mixin
@jhliberty
jhliberty / example.js
Last active August 29, 2015 14:17 — forked from eirikb/example.js
var nodify = require('nodify');
// Prints build time
console.log(nodify(function() {
return new Date();
}));
// Prints current time
console.log(new Date());
@jhliberty
jhliberty / cluster.js
Last active August 29, 2015 14:17 — forked from gregberge/cluster.js
var cluster = require('cluster');
if (cluster.isMaster) {
// Fork workers.
for (var i = 0; i < 20; i++) {
cluster.fork();
}
return ;

Components are taking center stage in Ember 2.0. Here are some things you can do today to make the transition as smooth as possible:

  • Use Ember CLI

  • In general, replace views + controllers with components

  • Only use controllers at the top-level for receiving data from the route, and use Ember.Controller instead of Ember.ArrayController or Ember.ObjectController

  • Fetch data in your route, and set it on attrs on your top-level controller:

    ```js   
    //controllers/index.js
    import Ember from 'ember';