General Assembly WDI, Week 1

Today is the first day of my second week in General Assembly Boston’s Web Development Immersive program, a twelve-week, full-time course focused on JavaScript and Rails. The course is intended to take people from no knowledge of programming to a full-time position as a developer, so some of the past week has been review, but I’ve loved every single second of it. Instead of my standard-ish This Week I Learned posts for the next three months, I’m hoping to do quick weekly recaps of how the program’s going.

Day 1

We spend most of Day 1 on the command line interface and on git. A couple of cool things:

  • cd - takes you to your previous working directory. SO HANDY.
  • use git checkout -b newbranchname to create a new branch and check out that branch simultaneously
  • I fixed my first-ever merge conflict!
  • GA emphasizes frequent commits and long commit messages. This wasn’t part of the course, but I recently learned about Angular.js-style commits, which seem like a great way to organize and communicate.

Day 2

Day 2 was our first day working with JavaScript. A couple of new pieces of information/new conventions:

Day 3

  • Seems obvious in hindsight, but you can isolate the unique elements in an array like this:
    let words = ['lots', 'of', 'words', 'of', 'words'];
    let uniqueWords = {};
    for (let i = 0, max = words.length; i < max; i++) {
      uniqueWords[words[i]] = true;
    } 
    

    This will give you an object where the keys are the unique elements in the array, and the values are true (as a convention; you can choose anything you want for the values). This is much simpler than my original approach, which involved…comparing all of the elements of the array to all of the elements? I don’t know. It was complicated and involved, and I don’t recommend it. Do this instead. If you want the final format to be an array, you can use Object.keys() to extract the keys (the unique words) and store them in a new array.

Day 4

  • Object properties are “attributes” when they point to values/primitives. Use constructor functions to attach attributes to an object.
  • Object properties are “methods” when they point to functions. Use prototypes to attach methods to an object. (Why? Functions that are attached using a constructor will be copied and attached over and over again to each new instance of an object. This is a huge waste of memory.)
  • Properties that begin with underscores are private (by convention): not intended for direct access or assignment.
  • “accumulator pattern” (all of the online resources I can find about this talk about it in Python, but it applies in other languages): initialize result, iterate, return result
  • We started using node to run and test scripts.
  • A callback is a function that is passed as a parameter to and executed inside of another function.

Day 5

    • When filtering and transforming an array (arrresultsresults[i] within an if statement can result in “holes” in the array when the original arr[i] doesn’t pass the filter. It’s better to use results.push to skip values that don’t pass, resulting in a cleaner results array.
    • Template literals (WHAAAAAAAAT so cool).

To sum up the week:

This Week I Learned (2016-07-19)

The Atlantic Ocean, 11.4 miles from Billington Sea.

The Atlantic Ocean, 11.4 miles from Billington Sea.

A one-kilometer-square freshwater pond in Plymouth, MA is called the Billington Sea because a 14-year-old fresh off the Mayflower climbed a tree and thought he could somehow see across the entire continent. The same kid fired a musket inside the Mayflower; his father was the first person executed for murder in Plymouth.

Flour explodes. A sufficient concentration of dispersed flour particles in the air can ignite even more explosively than coal dust. Thank you, season one of the Great British Baking Show! (Curious about how this works? Watch this adorable Mr. Wizard clip explaining flour mill explosions using lycopodium powder and an empty paint can or read Alexis Madrigal’s The Explosive Truth About Modern Flour Mills.

It’s possible to recover deleted notes from Simplenote. HOW DID I NOT KNOW THIS BEFORE? My biggest complaint with the software so far is that it’s far too easy to accidentally click the trash icon, and there’s no “are you sure?” warning before your todo list or draft blog post or extensive documentation of critical work functions disappears. “Trash” tag to the rescue.

My new favorite joke (thanks, Metafilter!). A QA engineer walks into a bar. Orders a beer. Orders 9999999999999 beers. Orders 0 beers. Orders -99999999999999 beers. Orders a ❤. Orders a lizard.

Convicted felons who are newly released from prison cannot have contact with other convicted felons in or out of prison, including family members. If you haven’t already read The Washington Post’s “One Year Out,” which profiles nonviolent drug offenders whose sentences Obama commuted, one year after their release from prison, you should go do that now.

This Week I Learned (2016-07-06)

How the amazing 780˚ montage in Hunt for the Wilderpeople was shot: “We hid all the actors beneath the camera and in the bushes. Each time we passed the camera by an actor, either an actor would pop up into frame or would run around the camera to take their place for another pass.”

Wikipedia has a list of the hex, HSV, and RGB values and official names for each Crayola crayon color (h/t Diana Kimball). My favorite color name is probably “Fuzzy Wuzzy,” but the scented (!) “Earthworm” is a close second.

Three pounds of pasta will feed 6 ultra runners, a mountain biker, and a hiker with enough left over to pack into a ziploc bag and use to make endless jokes about “the new hot endurance fuel” for the rest of the weekend.

Kaaterskill Falls (pronounced “Cat-erskill,” as in, the Catskills) is the tallest waterfall in New York, and worth the short hike to the swimming hole in the middle.

The excellent reason NASA named its Jupiter probe Juno (Juno was the Roman god Jupiter’s wife, and could use her goddess skills to blow away the cloud Jupiter tried to use to hide his extramarital dalliances—after whom planet-Jupiter’s moons are named). Also, Juno the probe is apparently carrying three Lego figurines.

This Week I Learned (2016-06-02)

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-05-18)

This Week I Learned (2016-05-10)

  • I’m better at adding things to my #TWIL file in Simplenote than I am at actually blogging about them.
  • If an input field’s font size is >= 16px, phones won’t automatically zoom in when a user focuses on the field.
  • Closures, via the JavaScript class I’m taking this semester, Preethi Kasireddy’s article in the freeCodeCamp channel on Medium, and the MDN reference. Key ideas so far: “an important use of closures: to maintain a private reference to a variable in the outer scope”; “you can use a closure anywhere that you might normally use an object with only a single method.”
  • In 1915, the New York Philharmonic had to issue a public notice asking concertgoers to refrain from knitting during the performance.
  • How to get data from the Digital Public Library of America API: particularly proud of this one because I helped write and edit this API’s documentation several years ago as part of my role as the senior project manager for the DPLA at the Berkman Center. I used it to build DPLA Images, an interface for searching the library for image records.

DPLA Images

This Week I Learned (2016-03-23)

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-03-09)

  • 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-03-03)

Not much—I was sick all week and spent most of my time sleeping/migraine-ing/coughing.

I did experiment with SASS, though—I’d dabbled a bit previously, but not seriously. Verdict: four stars.

I also discovered Mystery Show, Starlee Kine’s podcast on solving mysteries that are less true crime, more “how tall is Jake Gyllenhaal?” It’s excellent.

This Week I Learned (2016-02-23)

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.