Skip to content

Instantly share code, notes, and snippets.

View jakedetels's full-sized avatar

Jake Detels jakedetels

  • Portland, OR
  • 17:26 (UTC -08:00)
View GitHub Profile
@jakedetels
jakedetels / controllers.application.js
Last active April 14, 2016 01:09
observing injected objects
import Ember from 'ember';
var MockImportedObject = Ember.Object.create({
counter: 1
});
export default Ember.Controller.extend({
MockImportedObject,
counter: Ember.computed.alias('MockImportedObject.counter'),
actions: {
@jakedetels
jakedetels / application.controller.js
Last active December 2, 2016 16:22
Template registration issue
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
myComponentName: null,
actions: {
registerComponent() {
let template = Ember.Handlebars.compile('<b>First x-foo</b>');
@jakedetels
jakedetels / application.controller.js
Last active December 21, 2015 16:51
Ember.assgin
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
typeofAssign: typeof Ember.assign,
version: Ember.VERSION
});
@jakedetels
jakedetels / location.params.js.md
Last active August 29, 2015 14:21
JavaScript Utility for Getting/Setting URL Query Parameters

The location.params() function (shown below) can be used as a getter or setter. Examples:

Given the URL is http://example.com/?foo=bar&baz#some-hash,

  1. location.params() will return an object with all the query parameters: {foo: 'bar', baz: true}.
  2. location.params('foo') will return 'bar'.
  3. location.params({foo: undefined, hello: 'world', test: true}) will change the URL to http://example.com/?baz&hello=world&test#some-hash.

Here is the params() function, which can optionally be assigned to the window.location object.