This Week I Learned (2016-03-23)

JavaScript, landscaping, and Dutch babies.

Batching several weeks’ worth of learning into a single post because I was too busy having fun in Kansas (*happy dance, again*) to post.

  • The difference between prototypical and class-based object oriented programming languages (at least at a surface level): objects in prototypical languages (like JavaScript) are derived from other objects, and can become prototypes for other objects. In class-based languages (like PHP), you define a class, and then create objects that are instances of that class.
  • Inside a JavaScript constructor function, variables and functions declared directly are private. Variables and functions declared using this are public (or privileged—see Douglas Crockford’s “Private Members in JavaScript” for more).
  • In JavaScript, innerHTML can’t be appended—you can use += to append new content, but the end effect is to rewrite/reload all content within innerHTML on the page, rather than to tack on new material.
  • JavaScript has 12 types of nodes. Each has a number. Elements are 1, text nodes are 3.
  • The global context in JS is (in web browsers) the window object.
  • I liked this history of JavaScript (and JScript and ECMAScript).
  • I’m looking forward to installing a few of these Sublime Plugins—I use Bracket Highlighter and Color Highlighter all the time, and I have Emmet installed but keep forgetting to use it. SublimeCodeIntel and AdvancedNewFile sound particularly helpful.
  • How to tear down a deck, what a tiller is and how to use it, and how to lay weed barrier fabric: much landscaping work was done in Kansas last week.
  • Lunch at Blue Nile in Kansas City’s City Market last week reminded me that I need more Ethiopian food in my life.
  • You can totally make a Dutch baby in a 9×13 pan. Wishing I had known this for the 26 years of life when I didn’t own a cast iron skillet.

This Week I Learned (2016-02-23)

Danish pastry and regexp.

King Arthur Flour Danish classThis weekend, I took my first ever class at King Arthur Flour. You may notice a distinctly pastry-oriented slant to this week’s TWIL.

  • Adding salt to an egg wash helps break down the albumen, making it less gloppy.
  • High-fat butter (83% or higher) is the best for making laminated dough: it’s more pliable and less likely to fracture/tear the dough.
  • You can make Danish/croissants/puff pastry with shortening, but you’ll get a less crispy, less caramelized, less flaky, more tender result because you’re using 100% fat, which doesn’t have the water content necessary to create steam and puff up during baking. Also, shortening lacks the necessary milk proteins to brown.
  • How to upgrade OpenSSL on a Mac, which isn’t strictly necessary for security reasons, but is helpful to avoid warnings from other open source tools (like Composer).
  • The array.length property in JavaScript doesn’t give you the length of the array. That would be…too easy? Instead, it gives you a number one higher than the max index in the array.
  • I wrote my first piece of code in PHP using regex (to extract a bunch of words from HTML lists). I also wrote another, better piece of code to do the same thing using the PHP DOM, which I am so glad I now know is a thing. Along the way, I stumbled across this, which I will leave there to remind myself never to try to parse HTML with regex again.