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
/*
* 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';
    
#!/usr/bin/env ruby
require 'benchmark'
Benchmark.bm do |b|
n = 1_000_000
hash1 = {a: 1, b: 2, c: 3}
hash2 = {x: 1, y: 2, z: 3}
set nocompatible
syntax enable
set encoding=utf-8
set t_Co=256
call pathogen#infect()
filetype plugin indent on
runtime macros/matchit.vim
set background=dark
@jhliberty
jhliberty / generator-response
Created March 28, 2015 13:37
Error received when attempting to run sails generate ember-blueprints
[server]$ npm install sails-generate-ember-blueprints
sails-generate-ember-blueprints@0.0.5 node_modules/sails-generate-ember-blueprints
├── pluralize@1.1.2
├── merge-defaults@0.2.1 (lodash@2.4.1)
└── lodash@3.2.0
[server]$ sails generate ember-blueprints
Running generator (sails-generate-ember-blueprints) @ `/Users/jhliberty/work/Seeds-Master/DesiredResult/medicoreo/server`...
Installing "basic" of blueprints.
fs.js:521
//To run Q.js examples:
// 1. Open a new browser tab in Chrome and turn on developer toolbar.
// 2. Copy/Paste this gist in the console and hit enter to run all the snippets.
// Based on the inspiration from samples @ https://github.com/kriskowal/q
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
{
"app/adapters/*.js": {
"command": "adapter",
"template": [
"// export default DS.{capitalize}Adapter.extend();",
]
},
"app/components/*.js": {
"command": "component",