Skip to content

Instantly share code, notes, and snippets.

@machty
machty / hackathon
Last active December 12, 2015 10:08
all the emblem.js code i wrote for a hackathon
outlet
a.not-ad href="#" click="read target='view'" style=view.linkStyle
p == title
nav.top-bar
.social
each socials
partial social_item
@machty
machty / spec_spec_spec.js.coffee
Created February 11, 2013 20:33
mini konacha
#= require spec_helper
#= require manifest
#= require application
describe "web app", ->
beforeEach -> window.manifest = MANIFEST
it "exists", ->
assert.ok Fashionhack
Ember.onLoad('application', function() {
for(var name in Ember.TEMPLATES) {
var newName = name.replace(/embs\//, "");
Ember.TEMPLATES[newName] = Ember.TEMPLATES[name];
delete Ember.TEMPLATES[name];
}
});
# mouse can be used to select panes
set-option -g mouse-select-pane on
# mouse can be used to select windows (by clicking in the status bar)
set-option -g mouse-select-window on
# mouse can be used to resize panes (by dragging dividers)
set-option -g mouse-resize-pane on
# not really sure what this does, but with it, the scrollwheel works inside Vim
module EmberTemplateCompiler
module Source
base = "../../../../../dist/ember-template-compiler"
def self.bundled_path
File.expand_path(base + ".js", __FILE__)
end
def self.prod_bundled_path
File.expand_path(base + ".prod.js", __FILE__)
end
Thing = (function() {
var Thing = function() {
// this.whatever = asd
}
Thing.prototype.doIt = function() {
// Call function that no one has access to.
privateDoIt();
}
@machty
machty / ember-template-compiler.js
Created February 27, 2013 21:20
ember-template-compiler.js
(function() {
var Ember = { assert: function() {} };
// Version: v1.0.0-rc.1-78-gd4e6a5c
// Last commit: d4e6a5c (2013-02-26 10:34:28 -0500)
(function() {
/**
@module ember
@submodule ember-handlebars
@machty
machty / asd.js
Created March 3, 2013 03:19
breaking test case from second +new Date()
test('setTimeout should never run with a negative wait', function() {
var originalSetTimeout = window.setTimeout, newSetTimeoutUsed;
window.setTimeout = function() {
var wait = arguments[arguments.length - 1];
newSetTimeoutUsed = true;
ok(!isNaN(wait) && wait >= 0, 'wait is a non-negative number');
if(wait < 0 ) {
@machty
machty / ember-router-wishlist.md
Last active December 14, 2015 17:09
Ember.js Router Heaven - some thoughts on what will make the ember great
@machty
machty / ember-router.md
Last active December 14, 2015 21:09
Funnel through actions

Transition Handlers for Ember Router

Proposal

Add transitions hash to Ember.Route, which contains transition handlers for preventing/redirecting/decorating attempted transitions, whether initiated by transitionTo or URL change (handleURL).

Rationale

  1. Seal the app from unconstrained URL changes breaking your app's state machine
  2. Bring back router v1's state-based patterns while maintaining v2's lovely DSL for defining routes