Posts

Verifying Doubles with ActionMailer in Rails 4

Verifying doubles came out in RSpec 3, and it’s something that always sounded like such a brilliant yet obvious idea - make sure methods you stub actually exist. One friend in particular really stressed how many times this could have saved his tests from false positives. Sure, I thought, but usually I’d just modify something in the real code or modify the expectation to make sure it broke/worked in predictable ways, and move on. Then along came the perfect scenario while working on a little side project.

Below is the original spec and the corresponding controller method it's testing. (Things aren't especially DRY and a bunch of expectations are crammed into a single test to make things more explicit for this post.)
# spec it 'sends the admin a message about a new order' do   controller.stub(:params).and_return(fake_full_params)   expect(AdminMailer).to receive(:order_confirmation).with(fake_email_params).and_return(Mail::Message.new)
  allow_any_instance_of(Mail::Message).…

Recent Presentation: Understanding JavaScript in the Browser

I recently gave a short presentation to mostly non-Web developers, on what goes into the soup of the browser platform. I began by covering the many parties involved in standards - the W3C, WhatWG, TC39 committee, and others. Then, I introduced some of the other characters, like each browser vendor's rendering engine and JavaScript engine. It's a lot to keep track of, even just to keep a loose eye on things, not to mention the day-to-day effort (and fun discovery) of the many libraries and frameworks available to solve a problem. tldr - there are a lot of cooks in the Web kitchen.

I tried to highlight the great community tools like caniuse.com or csstriggers.com, and later demonstrated a few features of the developer tools, and the idea of the browser as the app platform and the IDE. (the JavaScript profiler, logging and analyzing xhr requests, the timeline, ol' trusty console) I also showed the final example from a great talk, What the heck is the event loop anyway?

Finall…

September in (and out of) iOS

This month my intention was to continue the Udacity Nanodegree program. I think the learn-by-doing approach it takes is great, and usually works well for me. However, in a fit of frustration -- wrestling with NSRegularExpression for something that would be trivial in many other languages and forgetting about the .rangeOfString method -- I began to reflect on the overall experience and my approach to learning at this point. What were really my goals in becoming a better iOS programmer? I'm familiar with enough of the APIs and resources for learning, can wade through the docs if necessary, have built some toy apps, etc. So why the urgency to add more to the never-ending list of things to keep up with (in code, business and law)? What other stuff would get put on the backburner for a while? 
Well, part of the problem is that the other stuff is never really on the backburner. I spend my days in Ruby and the browser, and absolutely love it, and my subway rides reading articles and keepi…

August in iOS

Last year I began working with iOS right around the time Swift came out. While I'm glad to have some familiarity with Objective C, Swift is much more comfortable (coming from working mostly in Ruby and Javascript). I soon dove in! While this blog's been silent in 2015 so far, I've got tons of draft posts sitting around that need to see the light of day.

One new commitment I've made is to start posting a monthly rundown of tips, tricks and adventures as I get back into iOS development, similar to the TMIL (This Month I Learned) series I posted in 2014. Zooming back to last year when I wanted to start learning another programming ecosystem beyond the web world I know and love, here are a few of the resources that helped me get started (and very much continue to help) with the world of iOS:

The Swift Programming Language (iBookshttp://www.raywenderlich.com/https://www.objc.io/WWDC videos (2015, 2014)Introducing iOS 8CS 193P
Zooming forward to a few months ago, I decided …

December #TMIL

This month I learned that this year I learned to keep a New Year's resolution alive, that documenting everything is usually a good idea, and most important, to relax and have fun during the holidays.

Happy 2015!

NovEmber #TMIL

Over the summer, I decided it was time to learn a client-side Javascript framework. I chose to start with Ember, mostly because it felt more like Rails and I kept hearing about the combination of an Ember app with a Rails backend. While I usually jump right in and try to build something, I had enough othercodingside projects going on at the time (and it was summer!), so I joined the Ember Weekly mailing list, attended a few of the NYC meetups and kept a loose eye on things... which have beenmovingalongquickly! By November, it was time for another look.

October #TMIL - Browser Extensions

From the Unfinished Business department:

At the Books in Browsers Conference hackathon in October, I worked with a few others to port the Readium Chrome extension, an in-browser epub reader, to Firefox. The core team had already been working on a branch which we didn't notice before diving in. Oops. However, it seems like they ran into the same issue that prevented us from going all the way: working with the user's filesystem from the extension.