This Week I Learned (2016-06-02)

Bicycle face, female depravity, floating point math, and the paamayim nekudotayim.

Three Sisters Lighthouses in Eastham, MA

  • A surprising number of early New England lighthouse keepers were either three-limbed men or widows. The Lighthouse Handbook New England has the tragic details.
  • Two things about bicycles in the 1890s:
    • The fear of something called “bicycle face.”
    • The fear that bicycles would lead to female depravity: “If there is any object on earth which makes jubilee in the realm of unclean spirits, it is a ‘society woman’ in masculine habiliments, straddling a bicycle and prepared to make an exhibition of her immodesty on the thoroughfares of a great city.”
  • (Compound) assignment operators: I knew about += and -=, but there are many, many more (JavaScript, PHP, Ruby).
  • Fun with operator names:
    • -> in PHP is called the “object operator” and is used to access the property of an instance of an object or to call a method of an instance of an object.
    • => doesn’t have an official name, but serves as the separator for associative arrays and is used to assign a value to a key.
    • :: is called the “scope resolution operator” but also the “paamayim nekudotayim,” which means “double colon” in Hebrew. It’s used to access static or constant properties or methods of a class.
    • (I wasted far too much time last semester trying to tell students when they should use the “dash plus the right arrow” or the “equals sign followed by the greater than sign.” Glad to have names for these, though I’m not sure “use the paamayim nekudotayim” will be much better.)
  • Fun with floating point math: “While floating-point addition and multiplication are both commutative (a + b = b + a and a×b = b×a), they are not necessarily associative. That is, (a + b) + c is not necessarily equal to a + (b + c). They are also not necessarily distributive. That is, (a + b) ×c may not be the same as a×c + b×c.”
  • Advice from GitHub on writing the perfect pull request, plus ThoughtBot’s guide to code review.

This Week I Learned (2016-03-09)

HackerRank, Belize, and coffee in Kansas.

  • I’ve been playing around with HackerRank a lot this week, and as I result I’m becoming more familiar with a wider set of functions (things like array_sum() and substr_replace()). Programming languages are languages, and this is a good way to drill vocab.
  • $array[] = $value; is the same as array_push($array, $value)
  • It’s entirely possible to book a trip to Belize with a few clicks: tickets and beachside bungalow were secured in a matter of minutes today.
  • Kansas City apparently has quite the coffee scene. Looking forward to checking it out this weekend when I go to Kansas (*happy dance*).
  • I finished all of Mystery Show’s first season last week and am now getting into the Myths & Legends podcast. Favorite episode so far: Thor’s fake wedding to a giant.

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.