Skip to content

Instantly share code, notes, and snippets.

View slindberg's full-sized avatar
I'm a mechanical engineer now

Steven Lindberg slindberg

I'm a mechanical engineer now
View GitHub Profile
slindberg /
Last active December 31, 2016 03:34
G-code for drawing an awesome face on a 3-axis CNC
(Modal reset)
G0 G90 G17 G40 H0 G70 G80
(Tool change - black sharpie)
G53 Z0.0
M06 T1
G54 X0.0 Y0.0
G0 Z0.25 H1
slindberg / app_templates_components_form-control.hbs
Last active December 8, 2016 03:19
Two-way bindings and the `mut` helper in Ember
<div class="form-control">
{{! Since mutable attributes are now wrapped, this will no longer work :( }}
{{input value=attrs.value}}
{{! Instead, we need to leverage some kind of event... }}
{{input value=attrs.value.value key-up=attrs.value.update}}
{{! Or, forgo two-way bindings and the `input` helper altogether, which forces us to create an explicit action... }}

Keybase proof

I hereby claim:

  • I am slindberg on github.
  • I am slindberg ( on keybase.
  • I have a public key whose fingerprint is B8DE 7D75 20BF AE0F 4BBF 5301 B3D8 0328 DA30 4283

To claim this, I am signing this object:

slindberg / if-all-exists.js
Last active August 29, 2015 13:57
Bound conditional Handlebars helpers for Ember
import ifConditionHelper from 'myapp/helpers/if-condition';
* Logical AND Existence Conditional Block
* Usage: {{#if-all-exists field1 field2}}Either field1 or field2 is truthy{{/if-all-exists}}
* Executes the given block if all arguments are defined
export default function() {
slindberg /
Last active August 29, 2015 13:56
Model 'Fragments' in Ember Data
slindberg / ember-data.dependent-relations.js
Last active November 5, 2021 21:41
Dependent Relationships in Ember Data
Ember Data: Dependent Relationships
This package extends Ember Data to support creating relationships
where a model's dirty state depends not only on its own attributes
but on the dirty state of models in dependent relationships as well.
App.Thing = DS.Model.extend({
name : DS.attr('string'),
slindberg / multi-select-input.hbs
Created January 23, 2014 22:05
Ember Components: Overridable Content Blocks Example
{{#content-for "option"}}
<a href="#">{{view.label}}</a>
{{#content-for "unselected-option"}}
{{content-for "option"}}
{{#content-for "selected-option"}}
{{content-for "option"}}
slindberg /
Last active July 27, 2022 09:22
Ember debug helpers intended to be used in the JavaScript console


This is a set of helpers for finding the application's currently active models/routes/controllers/etc. This isn't a straightforward process because of how Ember (rightly) encapsulates application objects, but it's useful in debugging environments to be able to quickly access them. And with the beta release of Ember Data, the store is not easily accessible without helpers either.


All helpers can be called directly if you provide them an application instance:

slindberg / adapter.js
Last active December 24, 2015 14:59
Ember data serializer that normalizes embedded records without ids
App.ApplicationSerializer = DS.RESTSerializer.extend({
// Extract embedded relations from the payload and load them into the store
normalizeRelationships: function(type, hash) {
var store =;
this._super(type, hash);
type.eachRelationship(function(attr, relationship) {
var relatedTypeKey = relationship.type.typeKey;
slindberg / index.html
Last active December 11, 2015 03:08 — forked from iffy/index.html
Custom path interpolator
path {
stroke: #f00;
.line {
stroke: #0f0;
fill: none;