Closure: It’s not a complex concept. Yet it’s hard to describe. Sure, a lot of programming jargon is abstract and requires a little bending of one’s mind. Polymorphism, reflection, encapsulation — hell, even abstraction is an abstract concept.
Mozilla’s docs describe closures like so:
Closures are functions that refer to independent (free) variables (variables that are used locally, but defined in an enclosing scope). …
[tl;dr — Use ActiveSupport::Concern with modules in your Rails tests to reuse behavior. Or read the longer discussion and learn more about what’s going on behind the scenes.]
Some consider Minitest “less readable.” I don’t really agree, and despite a lot of nice features, there’s something to be said for writing plain old Ruby vs. learning and remembering DSLs for both Rspec and Cucumber.
While studying up on the 2014 Formula One season, I spent a little time creating an animated GIF of Ferrari’s car over the last eight iterations. Interesting to watch the change of specific areas, like the front end and the rear wing. The images are centered on the driver’s position and are lined up as best as possible to be consistent with where the ground would be.
(Thanks to these guys for the images.)
Yeah, you wish this was about beer.
So you’re using some trick Web fonts for your site or app. It looks awesome in development. Yay.
You push to production, where your assets are all hosted on a CDN and suddenly your fonts stop working on Firefox and probably Internet Explorer (9+), too. You see crappy little squares where awesome fonts should be.
Bang. You’ve just run into the browsers’ same-origin policy restrictions.
JSONP is a way to fetch JSON data from a different domain, often in an asynchronous way, but without being restricted by the browser’s same-origin policy like you would be with
XMLHttpRequest. But perhaps you only know it via a library like jQuery, which auto-magically handles JSONP URLs. Here's a simple JSONP example and breakdown to show what's really going on behind the scenes.
I was recently quizzed on JSONP and how it works, and my response was something like, mumble … mumble … callback … mumble … use other dudes’ JSON. …
My 2008 unibody Macbook Pro has a loose screen. Loose and wobbly and drunken at times. It’s been chugging along loyally for over three years, and in Internet time, it’s like a Regis Philbin. But as we all know, old folks can get wobbly. No shame in that — but it happens.
The whole screen/monitor (the part that flips up) developed about 2 cm of back-and-forth play, and it felt like perhaps the hinge was loose. Still usable, but definitely putting a dent in my Macbook’s sexy. …
[Jason’s note: Three Days in Hell.A. is the account of two college journalists — David Downs (writer) and myself (photographer) — and our experience at the 2000 Democratic National Convention in Los Angeles, CA. It was originally published in August 2000 on jasonschock.com. The original story is preserved at the Internet Archive.]
Web developer and UX guy