Skip to content

Instantly share code, notes, and snippets.


Wesley Workman workmanw

View GitHub Profile
View gist:2311802
Application.tabelaPrincipalController = SC.ArrayController.create({
workmanw / UsersPage.Handlebars
Created Jun 30, 2012
View context preservation
View UsersPage.Handlebars
{{#each App.users}}
{{view App.UserWidget userBinding="this"}}
workmanw /
Created Jul 3, 2012

After a mind numbing week of updating all of the templates in our app and thinking about the implications of this change, I'd like to provide a little bit of feedback on this change.

Overall, I view this change as unfavorable. It's not that I dislike the change, it's that I don't find much value in it and it was a very daunting task to push to Ember users.

Template Simplification

From what I've gathered the purpose of this change is to "significantly reduce the verbosity of templates". I did not find that my templates either grew or shrank in size, they really remained constant. I believe one of the intended ways for reducing size was the elimination for the need of contentBinding="this" on {{view}} helpers. E.g.

{{#each App.photosController}}
workmanw /
Created Nov 13, 2012
Finding the biggest files in a git repo
for F in `git verify-pack -v .git/objects/pack/pack-*.idx | sort -k 3 -n | tail -10 | tail -r`; do
echo $F;
HASHKEY=`echo $F | cut -c 1-40`
FILEPATH=`git rev-list --objects --all | grep $HASHKEY | cut -c 42-128`
FILESIZE=`echo $F | cut -f 5 -d ' '`
FILESIZEHR=`echo "scale=2;$FILESIZE/1024/1024" | bc`

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

workmanw / Option1.js
Last active Aug 29, 2015
Controller Actions opinion
View Option1.js
Option 1 is the emberist way of doing it.
But I find that it makes it harder to group code in larger controllers.
BC.Controller.AssetDialog = BC.Controller.extend({
actions: {
showReference: function(reference) {
/* Open reference dialog */
View ic-ajax.js
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),(f.ic||(f.ic={})).ajax=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
"use strict";
* ic-ajax
* - (c) 2013 Instructure, Inc
* - please see license at
* - inspired by discourse ajax:
View components.message-listener.js
import Ember from 'ember';
import { BusListenerMixin } from 'demo-app/services/bus';
export default Ember.Component.extend(BusListenerMixin, {
classNames: ['message-listener'],
_setup: function() {
this.set('messageLog', []);
View application.template.hbs
<h1>Sites and Flights</h1>
View application.template.hbs
<h1>Welcome to my counter</h1>
{{#x-counter as |count increment decrement|}}
The count is: {{count}} <br><br>
{{x-button label="increment" on-click=increment}}
{{x-button label="decrement" on-click=decrement}}