Skip to content

Instantly share code, notes, and snippets.

View workmanw's full-sized avatar

Wesley Workman workmanw

View GitHub Profile
var B = {
foo: function (original) {
console.log("Foo B");
original();
}.enhance()
};
var C = {
foo: function () {
console.log("Foo C");
@workmanw
workmanw / gist:1928558
Created February 28, 2012 02:07
Installing SproutCore from source (OS X and Linux)
Installing RVM:
1. Installing RVM is as easy as:
$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
2. Add the following to your '.bash_profile':
# RUBY / RVM / SproutCore stuff
export RUBY_VERSION=ruby-1.9.2-head
export GEM_PATH=$HOME/.rvm/gems/ruby-1.9.2-head
source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
# It's best to open a new shell at this point so that your new variables are applied.
3. Instruct RVM to use Ruby 1.9.2:
@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'),
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 / 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}}
@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 / application.controller.js
Last active December 30, 2015 15:17
New Twiddle
import Ember from 'ember';
const DEFAULT_MODEL = {
relationship: {
isFulfilled: false,
someValue: false
}
}
export default Ember.Controller.extend({
appName:'Ember Twiddle',