Skip to content

Instantly share code, notes, and snippets.

@nathanhammond
nathanhammond / router.js
Created June 21, 2016 15:12
Routing Collisions
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: 'none',
rootURL: config.rootURL
});
Router.map(function() {
this.route('bar');
import Ember from 'ember';
export default Ember.Component.extend({
member: 'foo',
bleet(a, b, c) {
console.log('Member bleet!', arguments);
console.log(this.get('foo'));
},
actions: {
bleet(a, b, c) {
@nathanhammond
nathanhammond / components.my-component.js
Last active April 26, 2016 17:16
Simple Computed Binding
import Ember from 'ember';
export default Ember.Component.extend({
foo: false,
init: function() {
this._super()
setTimeout(() => {
this.set('foo', true);
}, 1000);
@nathanhammond
nathanhammond / ember-addon-output.sh
Last active May 27, 2016 17:46
Updating ember-new-output and ember-addon-output.
rm -rf ember-addon-output my-addon
git clone git@github.com:ember-cli/ember-addon-output.git
cd ember-addon-output
git rm -rf .
cd ../
ember addon -sn -sb -sg my-addon
cp -r my-addon/ ember-addon-output
EMBERVERSION=`ember version | grep "ember-cli:" | cut -d' ' -f2`
cd ember-addon-output
git add --all
@nathanhammond
nathanhammond / Manifest.md
Last active December 12, 2015 19:32
ember-cli individual module build

This is the manifest which is produced with the above modifications, highlighting items which don't appear in addons.js. How is it that they're being excluded?

(Some that are being excluded are because of header/footer inclusion, and I want those still.)


  • assets/swtest-app-8eaa577228cc7c7f64c1fa09ff6ce17a
  • assets/vendor-6808ebd858a42103e7a4a5d337433fac
  • bower_components/ember-cli-shims/app-shims-72f67a5d8a070a94eb67eac608340e1c
  • bower_components/ember-data/ember-data.prod-b93cdd76bc224763fa52848ebd4f34bb
@nathanhammond
nathanhammond / index.html
Created November 16, 2015 16:27
Service Worker fetch intercept timing.
<script>
function insertScript(src) {
var scripts = document.getElementsByTagName('script');
var newScript = document.createElement('script');
newScript.src = src;
scripts[0].parentNode.insertBefore(newScript, scripts[0]);
}
// This is contrived.
@nathanhammond
nathanhammond / components.my-component.js
Created August 20, 2015 23:00
Positional Parameters
import Ember from 'ember';
export default Ember.Component.extend({
positionalParams: ['one','two']
});
@nathanhammond
nathanhammond / OutletFocusing.md
Last active August 29, 2015 14:23
Ember Outlet Focusing

Keybase proof

I hereby claim:

  • I am nathanhammond on github.
  • I am nathanhammond (https://keybase.io/nathanhammond) on keybase.
  • I have a public key whose fingerprint is DD11 31B1 AF9A 0A66 EC41 CBFF F147 E765 0A00 8BAB

To claim this, I am signing this object:

@nathanhammond
nathanhammond / HandlebarsPrecompileFilter.rb
Last active December 22, 2015 07:38
Ember Handlebars precompilation rake-pipeline filter.
class HandlebarsPrecompileFilter < Rake::Pipeline::Filter
include Rake::Pipeline::Web::Filters::FilterWithDependencies
attr_reader :options
def initialize(options={},&block)
block ||= proc { |input| input.sub(/\.handlebars|\.hbs$/, '.hbs.js') }
super(&block)