Skip to content

Instantly share code, notes, and snippets.

@rlivsey
rlivsey / server.js
Created March 3, 2014 23:52
Quick hacky modification to broccoli server to work with history API
var broccoli = require('broccoli')
var helpers = require('broccoli/lib/helpers')
var path = require('path')
var hapi = require('hapi')
var synchronized = require('synchronized')
var tree = helpers.loadBrocfile()
var builder = new broccoli.Builder(tree)
serve(builder)
@rlivsey
rlivsey / thing.js
Created March 7, 2014 11:16
hash transform
Thing = FP.Model.extend({
things: FP.attr("hash")
})
thing = store.createRecord("thing", {
things: {
foo: 1,
bar: 2,
baz: 3
}
@rlivsey
rlivsey / components.md
Last active August 29, 2015 13:57
Ideas on replacing content in components

A Popover Menu Component

<div class="pop-over">
  <span class="pop-over-anchor">
    Pick Something
  </span>

  <div class="pop-over-body">
    <ul>

Keybase proof

I hereby claim:

  • I am rlivsey on github.
  • I am rlivsey (https://keybase.io/rlivsey) on keybase.
  • I have a public key whose fingerprint is 8FD2 C2D5 B45A 5ABE 6500 A7BC 4674 1858 8F70 6C03

To claim this, I am signing this object:

@rlivsey
rlivsey / dates.js
Created May 11, 2014 17:44
Deserialized query params are not available in model hooks
// a controller which has a date property which defaults to today, serialized it to query params as a string
FoosController = Ember.Route.extend({
queryParams: ["date:dateStr"],
date: function(){
return moment()
}.property(),
dateStr: function(k, value) {
@rlivsey
rlivsey / controller.coffee
Created May 22, 2014 16:12
date query params
IndexController = Ember.Controller.extend
queryParams: ["date"]
date: ((k,v) -> v || moment()).property()
`export default IndexController`
ThingController = Ember.ObjectController.extend
# "prematurely" triggers when the item is assigned when setting up the controller
# how to detect and ignore this?
titleChanged: (->
@send "detailsChanged"
).observes("title")
`export default ThingController`
ThingController = Ember.ObjectController.extend
contentChanging: (->
@_contentChanging = true
).observesBefore("content")
contentChanged: (->
@_contentChanging = false
).observes("content")
@rlivsey
rlivsey / pop-over-component.coffee
Last active August 29, 2015 14:03
An Ember pop-over component
`import {getScrollParent} from 'app/lib/dom'`
alias = Ember.computed.alias
PopOverComponent = Ember.Component.extend
classNames: "pop-over"
classNameBindings: ["position", "isShowing"]
isShowing: false
position: "bottom"
@rlivsey
rlivsey / index.js
Created July 30, 2014 11:33
ember-cli sass
var fs = require('fs');
var path = require('path');
function unwatchedTree(dir) {
return {
read: function() { return dir; },
cleanup: function() { }
};
}