Nobody Listens Anyway

Life is an optimization issue

I put on a little fat. It's kinda sexy

Salsa Beargrease

Salsa Beargrease

The Salsa Beargrease is what happens when a Ferrari and an Abrams Tank have a one night stand. The bastard child of the cycling industry, fat bikes are finding their place in the mainstream of mountain biking. While most sales guys will tell you these odd balls with ginormous tires find purpose in gliding over snow or floating over sand I disagree. These monstrosities have one purpose - to make grown men giggle like 3 year olds on a merry go round.

I've lusted over various instantiations of the fat bike for a few years, but each time I've overcome temptation. Each time I've walked away a less debt ridden man. Today satan led me right down that path we love to trod and I gave in. Of course, it didn't help that Wayne at Joyride bikes gave me a killer deal. I dunno no, maybe Wayne is satan. If he is, he's a really nice evil guy.

The River Trail in Logan Canyon is a gentle introduction to mountain biking no matter what you ride. It serves as ground zero for all my cyclocross training. On my very light and very nimble Bianchi Cavaria the ground demands constant attention or your face will get the chance to decorate one of the log pole pines that line the trail. I love the experience but it’s like a carefully choreographed ballet on two wheels as you tip toe...

Ember Conf 2014 Summary and Resources

This is a mainly a list of links to notes that others took and a few of my own notes from Ember Conf.

Some Great Write Ups:

Keynote by Yehuda Katz and Tom Dale

Yehuda Katz and Tom Dale keynote

Slides from the EmberConf keynote

Notes from Allison Sheren

  • "Having the right thing be default is not a small tweak. It's the difference between being productive and not being productive." -- Yehuda Katz (@wycats)
  • "The fact is that the flexibiltiy we think...

Ember Conf 2014 Wrap Up

Ember.js' strength as a framework is second only to its power as a community. Over the past two days at Ember Conf I've had a chance to interact with some of the top minds in the Javascript world who are shaping the future of the web. Brian Cardarella did an excellent job summarizing the mood of the conference - "Ember.js picks up where Rails left off." Years ago I remember attending my very first Mountain West Ruby conference and leaving with a similar impression. That same year we attended Rails Conf 2007 in Portland and via a serendipitious conversation with David Heinemeier Hansson I came to understand the counter-culture, rockstar, ninja facade was a carefully engineered marketing play by 37 Signals. That effort worked out very well for them. The press asked for rebels and DHH and company happily complied. I still have the image of DHH's leather jacket embroidered with a dragon emblazed on my memory. Rails was very much 37 Signals and their energy and popularity raised an army of brilliant contributors w...

ActiveRecord has_many through multiple models

More than a few times now I've run into a situation where I really need to be able to relate one object to another through multiple tables - basically use 'has_many' twice.

Here's an example set of objects where a user can have many products but to get to the products you have to first go through associations and then through companies. 'user.companies' is straight forward ActiveRecord but 'user.companies.products' won't give you what you need.

class User < ActiveRecord::Base
  has_many :associations
  has_many :companies, :through => :associations
end

class Association < ActiveRecord::Base
  belongs_to :user
  belongs_to :company
end

class Company < ActiveRecord::Base
  has_many :associations
  has_many :users, :through => :associations
  has_many :products
end

class Product < ActiveRecord::Base
  belongs_to :company
end

What I really want to do is setup an efficient query that bypasses the companies table. The associations table and the products table both have a 'compan...

Hardware Hacking with JS

With the Cache Maker club we're always looking for ways to make it easier for kids to interact with hardware. Traditionally, interacting with hardware meant learning assembly or if you picked the right platform you could write embedded C. Today things are different.

With Arduino we have an open source hardware platform with libraries in your favorite language. Javascript is an approachable language. Put the two together and kids can program hardware.

That's why "Hardware Hacking with JS" with Jamison Dance (@jergason) was so awesome.

Here's the hackpad notes

Here's Jamison flying a parrot drone using an xbox controller via node.js:

Bringing the Web Back to the Blind with Ryan Florence

Ryan Florence presenting "Bringing the Web Back to the Blind".

Probably the biggest accessiblity resource on the web: webaim.org.

Accessiblity

Accessiblity is more than just alt tags. You still want alt tags but there's more.

Use your headers for organization of content rather than for visual display. It helps blind users navigation through the content based on its importance.

Landmarks

Use the role tag on elements. For example:

<div role="main"></div>

Adding 'role="main"' provides a 'landmark' in the page that a screen reader can find. A blind user can use these landmarks to quickly navigate to specific sections of the page.

Html 5 includes a 'main' tag as well as others like 'article' that screen readers can use as landmarks.

Screen Reader Specific Content

Use css to hide text that is important for screen readers. Create a 'visually-hidden' css class then include additional information to to describe the element. ...

Vector Programming and Reactive Javascript

The Functional Part

Don't describe how to process the data using a loop instead have your code state what you want to happen.

Use functional concepts to build nice observable streams:

  • Map: transform one collection into another.
  • Filter: filter one collection into a smaller collection.
  • Reduce: take a collection and reduce it into a single result (like inject in Ruby).
  • Zip: zip two collections into a single collection.

Reactive programming requires thinking functionaly.

Observables

  • Turn events into collections.
  • Allow you to handle errors in the collection.
  • Unsubscribe when the event is done.

Observable methods

  • merge: combine collections into a collection as each item arrives.
  • concatAll: combine collections into a new collection in the order in which they were created. Flatten async requests and resolve race conditions.
  • takeUntil: creates a single observable of a source collection and a stop collection. When event from stop collection occurs unsubscribe from source.
  • switchLatest: only use the latest collection. Throw o...

Pete Hunt - Be predictable, not correct.

Mountain West Javascript starts today. Peter Hunt, Facebook developer and contributor to reactjs.org is first up presenting "Be predictable, not correct."

Here's my notes:

Even better: Notes on Hackpad

Key Value Observation (KVO)

This is the pattern that Ember.js implements. Idea is to bind data to elements in the DOM. The problem is that we have to use units of computation that the platform gives you. This results in leaky abstractions. The developer has to hold to much information in their head and solutions become complex to implement. Can't compose using primitivies Angular uses Dirty Checking.

NOT the simpliest way to build things.

Reactive Design

In a mythical javascript language we could use Javascript primitives and we would have a reactive DOM. However, Javascript is not reactive. We do need to build some layer of abstraction. Reactjs built a reactive DOM. No databinding artifacts. Takes advantage of existing Javascript.

Virtual DOM

  • Whenever anything may have...

Refactoring and Making Promises

After spending the last year writing Ember.js code I've realized one really big thing - Ember is about promises. I recently had a chance to refactor some code with a number of asynchrounous calls. The original logic used timers and polling to monitor the state of a bunch of recursive calls to the Google API to retrieve a complete folder structure. Timers get the job done, but promises make it elegant.

Original Code

Requirement: wait until the entire tree is loaded before transition.

App.GoogleFile = Ember.Object.extend({
});

App.ApplicationRoute = Ember.Route.extend({

  model: function(){
    var model = App.GoogleFile.create({
      id: $('meta[name="google-folder-id"]').attr('content');
      children: Ember.ArrayProxy.create({content: []})
    });
    this.loadChildren(model.get('children'));
    return model;
  },

  afterModel: function(transition){
    if(transition.targetName == "application.index"){
      this.wait(model.get('children'), function(){
        this.transiti...

Beautiful day. Had to blow off work for a ride

I've spent the winter on a trainer. I don't mind the experience so much. It's not like riding outside, but I do it in hopes of maintaining some level of fitness during the winter months. The first ride of each Spring provides an opportunity to gauge whether all the time spent spinning my legs watching TV with the fan on and the window open were worth it.

I approach this first ride with some trepidation.

The first ride of each Spring requires a re-amplification of courage. The trainer is easy. If you tire you rest. No one on Strava will know. If you need water it's upstairs. Selecting clothing is a simple process. The most difficult part of the experience is figuring out what drivel Netflix can provide for an hour and a half. (I've watched every Firefly, Dr. Who, Stargate, Star Trek Enterprise, Star Trek Voyager, Falling Skies, numerous movies and worthless SyFy rejects while on the trainer. Finding something to watch is becoming a problem).

Taking to the great outdoors requires a deeper understanding of the environment and your body. Selecting the right clothing on a Spring day is tricky. The wind can cause the temperature to vary greatly. Standing still with the sun on your face might feel perfect. Move your body through that same air at 20 miles an hour and everything cools off dramatically. Of course, push your body, your core heats up and you become and artist at striping while h...