Tag: code

  • Ember.JS: How to handle invalid URLs

    There’s a lot of documentation for the new Ember Router. However, I found that no one was talking about how to handle the “*” route in Ember, i.e. the routes that don’t match anything. I first tried to look at the ApplicationRoute but that didn’t seem to throw anything. Ember just sits there with a…

  • How is Facebook Chat Heads possible on Android?

    This has been the question since the day I saw Facebook unveil the new Facebook Home suite of apps. Workmate of mine (@stevelarkin_) might have found the answer on good-ol’ StackOverflow! http://stackoverflow.com/questions/13346111/draw-overlay-in-android-system-wide ​Basically, you are able to spawn a service which draws directly on to the Android System’s WindowManager by adding a new subview on…

  • Rails Validating Field vs Association

    ​One really interesting thing I came across recently is validating a field vs association. I’ve always written something like this (assume this is a… Company model with a attribute called owner_id and a belongs_to association called owner): What’s better to write is: This actually makes sure that your :owner_id actually maps to a real object in the database.…