Made with Drew

Recovering JavaScript developer

Division by Zero

Found some interesting idiosyncrasies while doing some floating point math. float64(1) / 0 // panic: division by zero float64(1) / float64(0) // panic: division by zero All good so far, then it gets more interesting. var f1 float64 f1 = float64(0) float64(1) / f1 // +Inf float64(0) / f1 // NaN It appears the compiler provides some safety when using static types, but does not provide the same benefit for variables.

Spotify Crashing on iOS8

If you’re experiencing Spotify crashes after upgrading to iOS8, try this little trick. Open Settings > General > Language & Region Switch Region to another country (I used Uruguay), now open Spotify. If that worked, switch your Region back to United States. Happy Spotifying

Statically Linking C to Go

A little trick to statically link C to Golang with cgo There’s a lot of information out there about how to link C and Go. I found it took a combinaton of all of that information to properly statically link my C code to Go. I will preface this by saying I’m not a native C developer. Most of this research was done in an exploration of getting Go code linking against C via trial and error.

Current browsers

The nice thing about working on the web is that it’s constantly evolving, this also turns out to be a challenging part of working on the web. We closely monitor our traffic by platform (desktop, tablet, phone) and by browser (Chrome, Firefox, IE, Safari, etc). This data is very useful when we see sudden traffic changes. Every now and then, we will pick up issues with page completion rate in a browser.

Choosing a Go Web Framework

It’s very easy to write your own website in Go. Just check out the very excellently documented http package. However, there’s a lot more to building a website than serving content. There’s many things to think about: Session management Caching Logging Database access Asynchronous job queue Development and deployment tools MVC or other architectural pattern It’s easy to go rambo on this effort writing your own session management and logging library, but your time my be better served checking out some of the open source libraries being developed and there are many available.

Simple concurrency in Go

I have been hearing about Go a lot lately including it being the most requested language at my work. This got me interested in why people find it so appealing. Developer enthusiasm boils down to one of a few reasons: The New Hotness Marketing - Develop 50% faster, that’s more time for showers! Developers wanting to learn something new I fell very strongly into #3. I like to get my hands dirty, and learning a new language is a great way to do that.

Pipelines in Go Templates

Go templates mix an excellent blent of flexibility and powerful features. The html/templates package even has context aware templating for handling HTML escaping and JavaScript variable declaration. One thing I tripped over is using the very powerful pipeline feature to specify custom pipelines. This worked fine for a single template, but I kept getting. panic: template: view.tmpl:9: function "titleExpand" not defined Doing this on each template is cumbersome, here’s how I applied titleExpand to all templates.

Working with dppx

There’s a better metric in retina detection called dppx, Chrome Canary will now warn you for continuing to use dpi. Glossary device-pixel-ratio: Number of device pixels per CSS Pixel dpi: Dots per inch dppx: Number of dots per px unit. 1dppx = 96dpi Now your first question, why do we need dppx when device-pixel-ratio exists? Well in typical fashion, CSS was too slow on fixing the CSS resolution problem. In order to make retina usable in CSS, webkit invented device-pixel-ratio.

Using Bourbon Neat

In my last post, I talked about what I had done but not how I did it. Now let’s get into the nitty gritty of Bourbon Neat. Bourbon is installed via the neat gem, once installed you can call neat to manage everything about neat. neat install neat update neat remove This will install neat to a subdirectory, much like how bourbon is installed. The beauty of SASS is that we now have installed a ton of fundamental CSS functionality, but we get to pick and choose which features we want to take advantage of.

Bourbon Neat

At work I was tasked with building a new Tablet version of the site. As a greenfield project, every stakeholder had two cents on how the project should go. Things I heard: We need fat finger support Our desktop site is ugly How can we improve click through rate on Tablet? Can we support responsive web aka Browser Wanking? As many projects go, we leaped straight into answering all these questions without really thinking about what it all means.