Skip to content

Instantly share code, notes, and snippets.

I'm a mechanical engineer now

Steven Lindberg slindberg

I'm a mechanical engineer now
View GitHub Profile
slindberg /
Last active Dec 31, 2016
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 Dec 8, 2016
Two-way bindings and the `mut` helper in Ember
View app_templates_components_form-control.hbs
<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 Aug 29, 2015
Bound conditional Handlebars helpers for Ember
View if-all-exists.js
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 Aug 29, 2015
Model 'Fragments' in Ember Data
slindberg / ember-data.dependent-relations.js
Last active Mar 7, 2016
Dependent Relationships in Ember Data
View ember-data.dependent-relations.js
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 Jan 23, 2014
Ember Components: Overridable Content Blocks Example
View multi-select-input.hbs
{{#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 Feb 19, 2018
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 Dec 24, 2015
Ember data serializer that normalizes embedded records without ids
View adapter.js
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 Dec 11, 2015 — forked from iffy/index.html
Custom path interpolator
View index.html
path {
stroke: #f00;
.line {
stroke: #0f0;
fill: none;