Mike HeaversWeb, Writing, Creative Coding

Recent

Displaying tweets on your website using Twitter’s 1.1 API on Middleman with PHP / jQuery

In Twitter’s latest version of its API, you must now authenticate in order to pull tweets. Yes even public ones. Yes, even your own. I recently had to cross the bridge on a site I was building using the static site generator Middleman. And while the final solution was pretty easy to set up, finding that solution took a bit of time, so I figured I’d post my solution here to hopefully save others the trouble. This tutorial is not Middleman specific, but I include that step below.

Middleman is

...read more

Rendering Ruby ERB partials with variables in a loop using Middleman

Middleman is the easiest static site generator I’ve ever used. A one command install, a great boilerplate to get you going, and a solid system of templates, variables, dependency management, helpers, etc covers everything you need for an average front-end focused site. And while Middleman does a lot, it was a bit difficult for me to see how to tie all the various functionality together in order to render partials that had been passed variables, so I thought I’d jot down this tip.

If you have a

...read more

Prevent losing scope of “this” in backbone on jQuery animations or setTimeouts with underscore

This is a simple tip that Matt Kenefick showed me to solve issues within a framework on delayed events such as animations or settimeouts. The issue encountered is this - you have your framework setup such that “this” refers to the view you are working in:

And now let’s say you want to delay the doAnimation() function a half a second:


Here, we’ve lost scope of the view (View_Module). So how to preserve that reference? Use underscore.js‘s “bind” method:

How about parameters? Let’s

...read more

More Tutorials >