That piece of syntax is Promise.all.
Promises encapsulate asynchronous code and create an easy way of starting and resolving streams of code out of direct sequence. Whereas event listeners are instantiated and then respond to external events asynchronously — which can create issues where an event that occurs before the listener is instantiated goes overlooked — a Promise begins and ends all within defined code blocks, and resolves once. …
So for a little background:
But alas, we pulled up the Web Audio API documentation in the Mozilla Developer Network documentation and there was not a single mention of AJAX requests, JSON — there wasn’t even a single mention of Promises!
~20 lines of code yields a deep bass sound on the page (in this case a 50Hz sine wave; put on some headphones, ‘cause your tinny laptop speakers won’t cut it). With the same lines of code an a few edits, I could just as well render any frequency in a number of waveforms (see lines 11–13…
Proactively protect your sensitive data from running off the Rails
Figaro is a very nifty tool for proactively protecting your rails project, so that you don’t ever have to use BFG, which I wrote about last week.
While BFG is for cleaning out your GIT repository tree, e.g. when you have accidentally uploaded sensitive data, Figaro is just the tool to prevent this from happening in the first place.
First in your rails app, add Figaro to your Gemfile and
Next, execute the gem:
$ bundle exec figaro install
This creates a commented
Although it was among my most cherished stories of my early childhood, this article is not about the Big Friendly Giant or his eponymous novel by Roald Dahl — no Fleshlumpeaters, Snozzcumbers, or Whizzpopping. Sorry!
BFG is a tool I encountered recently because of a pretty awful mistake I made in one of my git repositories. Designing my first API-leveraging program, I was juggling enough new structural and syntactical concepts that I didn’t think twice before throwing my API key right into a constant in the class that used it make a rest-client request.
Of course, I was lucky only to have made this beginner’s mistake with a New York Times API key — they aren’t hard to acquire, don’t provide access to personal and or account information, and won’t allow other users who have access to it to ring up an array of charges. So in that regard I was certainly lucky. This is not an uncommon mistake among developers, and it could be much worse — I’ve heard stories of amazon bills in the hundreds as the cost of an API key compromised in a public repository on Github. …
Week four of Flatiron School’s web dev bootcamp is on the threshold, and the last few weeks have borne a rapid ascent from the basics of Ruby to the implementation of complete dynamic web servers. Of all of the ideological traversals that we have made, the most startling for me has been the understanding of the distinction between dynamic and static web hosting and details of the broader workings of the internet that come with that distinction.
First, it should be noted that the internet is actually connected by giant transoceanic cables.
I always thought that was just an extended joke on Ted…
I’m learning to program.
Learning to program at its very beginnings requires a shift in the way that I imagine: it permutes the very definition of action and the very action of definition, and blurs the line between the two.
This is because of the semantic nature of code. In the physical realm, I might think of an action — to snap a portrait — as an abstract concept, or as a plan that is distinct from the action that I actually take to snap the portrait. …