Skip to content

Instantly share code, notes, and snippets.

Avatar

Wesley Workman workmanw

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

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 Nov 13, 2012
Finding the biggest files in a git repo
View git_big_file_finder.sh
#!/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`
View 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 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 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
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', []);
}.on('didInitAttrs'),
View application.template.hbs
<h1>Sites and Flights</h1>
{{outlet}}
<br>
<br>
View application.template.hbs
<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}}