Skip to content

Instantly share code, notes, and snippets.

View workmanw's full-sized avatar

Wesley Workman workmanw

View GitHub Profile
Application.tabelaPrincipalController = SC.ArrayController.create({
});
Application.tabelaPrincipalController.set('content', Application.store.find(Application.solicitacoesRecord));
@workmanw
workmanw / UsersPage.Handlebars
Created June 30, 2012 01:48
View context preservation
{{#each App.users}}
{{view App.UserWidget userBinding="this"}}
{{/each}}
@workmanw
workmanw / Feedback.md
Created July 3, 2012 19:44
Feedback on Ember `VIEW_PRESERVES_CONTEXT`

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
workmanw / git_big_file_finder.sh
Created November 13, 2012 01:42
Finding the biggest files in a git repo
#!/bin/bash
IFS=$'\n'
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`
@workmanw
workmanw / pr.md
Created March 25, 2013 12:34 — forked from piscisaureus/pr.md

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 = git@github.com:joyent/node.git

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
workmanw / Option1.js
Last active August 29, 2015 13:57
Controller Actions opinion
/*
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 */
}
}
!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 https://github.com/instructure/ic-ajax/blob/master/LICENSE
* - inspired by discourse ajax: https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/mixi
@workmanw
workmanw / components.message-listener.js
Last active October 1, 2015 07:45
Ember PubSub Service
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', []);
}.on('didInitAttrs'),
@workmanw
workmanw / application.template.hbs
Last active October 14, 2017 06:21
Sites and Flights
<h1>Sites and Flights</h1>
{{outlet}}
<br>
<br>
@workmanw
workmanw / application.template.hbs
Created October 27, 2015 16:00
Yielding Actions
<h1>Welcome to my counter</h1>
<br>
{{#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}}
{{/x-counter}}