Skip to content

Instantly share code, notes, and snippets.

View sgharms's full-sized avatar

Steven G. Harms sgharms

View GitHub Profile
@sgharms
sgharms / 1.0pre Ember.js
Created August 7, 2012 21:43
1.0pre Ember
// Version: v0.9.8.1-658-gd4a9e46
// Last commit: d4a9e46 (2012-07-21 19:16:48 -0700)
(function() {
/*global __fail__*/
if ('undefined' === typeof Ember) {
Ember = {};
// ==========================================================================
// Project: Ember - JavaScript Application Framework
// Copyright: ©2006-2011 Strobe Inc. and contributors.
// Portions ©2008-2011 Apple Inc. All rights reserved.
// License: Licensed under MIT license (see license.js)
// ==========================================================================
var view;
var application;
var set = Ember.set, get = Ember.get, getPath = Ember.getPath;
heroes: Ember.Route.extend({
route: '/heroes',
index: Ember.Route.extend({
route: '/',
enter: function( router ){
console.log("Someone entered /heroes");
},
connectOutlets: function(router){
router.get('heroesController').connectOutlet('heroes');
}
@sgharms
sgharms / gist:2896428
Created June 8, 2012 16:01
Ember 0.9.8 and VIEW_PRESERVES_CONTEXT
The first time I dropped 0.9.8 in, I was immediately struck with the
thought: "HOLY ZEBULON PIKE ON A ZEBRA, NONE OF THE ITEMS IN Ember.CollectionViews
ARE SHOWING?!"
The change has to do with whether views render their templates using
themselves as the context, or whether it is inherited from the parent.
Alternatively said:
"it is trying to look up [...] properties on the view instead of the
parent context[TD]."
0.9.7:
<script type="text/x-handlebars" data-template-name="template-one">
{{! debugger point 1 }}
{{debugger}}
{{view Ember.View entriesBinding="App.folders.content" templateName="template-two" larryBinding="birdger"}}
</script>
<script type="text/x-handlebars" data-template-name="template-two">
{{! debugger point 2 }}
@sgharms
sgharms / fixes.md
Created May 3, 2012 18:00 — forked from zoras/fixes.md
Getting rid of nokogiri segfaults: May 3 2012

First diagnose which version of libxml2 you're using:

bundle exec nokogiri -v

If you have 2.7.3 listed somewhere, you're in bad waters (known to segfault). Install this:

brew update
brew install libxml2
brew install libxslt
@sgharms
sgharms / gist:2468632
Created April 23, 2012 03:14
Kill whitespace with fire
function! s:ScourgeWhitespace(flag)
"{{{1
if ( a:flag ==# "!" )
echo "Killing whitespace with fire..."
%s/ \+$//
else
echo "Gently helping you to remove whitespace..."
%s/ \+$//c
endif
endfunction
{{ view Ember.Select
contentBinding="Sorter.SortController.options"
optionLabelPath="content.label"
optionValuePath="content.value"
prompt="Sort some numbers..."
selectionBinding="Sorter.SortController.selected"
}}
function! s:ScourgeWhitespace(flag)
if ( a:flag ==# "!" )
echo "Killing whitespace with fire..."
else
echo "Gently helping you to remove whitespace..."
execute "s/\ \+$//gc"
endif
endfunction
command! -bang ScourgeWS call s:ScourgeWhitespace('<bang>')
1.9.3p125 :070 > date => "03/26/2012 08:08:34 UTC"
1.9.3p125 :074 > DateTime.strptime(date,"%m/%d/%Y %H:%M:%S %Z").to_s => "2012-03-26T08:08:34+00:00"
1.9.3p125 :076 > DateTime.strptime(date,"%m/%d/%Y %H:%M:%S %z").strftime("%a %b %e %l:%M:%S %Z %Y")
=> "Mon Mar 26 8:08:34 +00:00 2012"
But I want...
Mon Mar 26 08:08:34 UTC 2012
I seem to be missing a tiny something....