Skip to content

Instantly share code, notes, and snippets.

{
"summary": {
"build": {
"type": "initial",
"count": 0,
"outputChangedFiles": [
"assets/ena.css",
"assets/ena.js",
"assets/ena.map",
"assets/failed.png",
{
"summary": {
"buildCount": 0,
"output": "/Users/dhamilto/src/hjdivad/ena2.4/tmp/broccoli_merge_trees-output_path-NnUesZPT.tmp",
"totalTime": 1322393786,
"totalNodes": 320,
"stats": {
"fs": {
"realpathSync": {
"count": 375,
and = Ember.computed.and;
equal = Ember.computed.equal;
bool = Ember.computed.bool;

Ember.Object.extend({
  isHeirToCasterlyRock: and(equal('lastName', 'Lannister'),
                            bool('isEldestSon')),  // Primogeniture is actually
                                                  // more complicated but w/e

Literals vs Properties in CPs

Something that's currently very annoying about CPs is that whether arguments are literals or properties is something that must be decided at macro-design time, rather than at macro-use time.

Consider for instance Ember.computed.equal. It would be nice to be able to use the same macro for creating CPs that compare against literal values as well as against properties.

/usr/bin/vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug 24 2013 18:58:47)
Compiled by root@apple.com
Normal version without GUI. Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
-conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv

Ember.select Slide

  • s/Ember.select/Ember.Select i think.

This slide is damn funny ^_^

Array Computed Slide

Nothing to add to the slide, but a minor note to keep in mind: there is another difference. arrayComputed adds observers to keep refs up to date. So eg

# ~/.gitconfig

[alias]
  # "fetch origin"
  fo = fetch --prune origin
  # "checkout pull request"
  cpr = "!f() { git checkout -b pull/$1 pull-requests/$1; }; f"

[remote "origin"]
@hjdivad
hjdivad / jasmine-bug-ember-object-printer.js
Last active December 15, 2015 20:49
Work around jasmine bug when failed expectation is on an Ember object
var originalEmitObject = jasmine.StringPrettyPrinter.prototype.emitObject,
originalHtmlReporterParameters = jasmine.HtmlReporter.parameters;
jasmine.StringPrettyPrinter.prototype.emitObject = function( object ) {
if( Ember.Object.detectInstance( object )){
this.append( object.toString() );
} else {
originalEmitObject.apply( this, arguments );
}
};
@hjdivad
hjdivad / v.js
Created February 26, 2013 21:58
Ember.VERSION;
// "1.0.pre"
(function(render, destroy) {
Ember.View.prototype.render = function(){ console.log("render", this.toString()); return render.apply(this,arguments); };
Ember.View.prototype.destroy = function(){ console.log("destroy", this.toString()); return destroy.apply(this,arguments); };
})(Ember.View.prototype.render, Ember.View.prototype.destroy);
# environments/development.rb
# require ruby-debug if you're not in bundler
Signal.trap("USR1"){ debugger }
# Then in bash (alias for convenience)
# kill -usr1 `cat tmp/pid/server.pid`