The hottest job on the planet

Issue #30.January 11, 2021.2 Minute read.
Bytes

Wasmer 1.0 Released

Containers

Some OG containerization

Wasmer, boss-mer… After two years of work, YC-backed Wasmer just released v1.0 of its runtime that promises to let you “run any code on any client.”

WTF is Wasmer? It’s a server-side WebAssembly runtime that enables lightweight containers that can run in any programming language. So you can use any of the tools and languages you love (like JavaScript, obvi), and then Wasmer will compile everything to WebAssembly.

Let’s get into some of the new features which make Wasmer 1.0 even… awesome-r.

  • Runs anywhere: Because Wasmer utilizes WebAssembly for all of the containerization, it’s able to create “universal binaries” that work on every platform (Linux, macOS, Windows, web browsers, and more) without needing modification.

  • Fast and safe: Wasmer runs at “near-native” speeds and automatically sandboxes applications, so you can execute untrusted code safely. And since WebAssembly provides such a lean execution environment, Wasmer containers can run in places where Docker containers are too heavy to work (like IoT devices at the edge).

  • Pluggable Infrastructure: Choose your own adventure compiler frameworks with out-of-the-box support for Singlepass, Cranelift, LLVM, and others.

  • N00b-friendly API: One of Wasmer 1.0’s main goals was to simplify its APIs so it would be easy to learn for developers who aren’t very familiar with the WebAssembly ecosystem (AKA most developers).

The Bottom Line

By now, you might be thinking, “but I’m a web developer. I haven’t had to think about binaries since my last job interview!”

Fair point, but as WebAssembly continues to make its way into the mainstream web-dev world, we think it’ll be worth becoming familiar with tools like Wasmer.

Plus, rumor has it that using WebAssembly just once will automatically jump you to the Mage Class of the HackerNews hierarchy, which unlocks special abilities like an unearned sense of superiority over your peers.


Job Listing — Come work at Parler!

Parler

The hottest job on the planet.

Come join the team behind the thriving social network that everyone is talking about! At Parler, you’ll get the chance to work on the tech behind one of the web’s great echo chambers. What we lack in diversity, we make up for with blind fervor.

We’re looking for self-starters with 8-12 years of experience to join our engineering team as junior software developers.

Previous experience required in:

  • Android development, iOS development, Platform agnostic!
  • Deploying to AWS Setting up and maintaining in-house servers
  • DNS
  • CDNs
  • Creating your own ISP

We move fast and break everything!


JS Tip- Loops and Labels

JavaScript has at least 20 different ways to loop over things, including all of the array methods, like forEach, map, and filter; recursive functions; and while, and for.

For array methods and recursive functions, you can end a loop early with a return statement, but if you were to use a return statement in a while or for loop, it would end the entire function, which is not ideal. Instead, if you want to jump to the next iteration of the loop, you can use the continue statement, like so.

for (let i = 0; i < 10; i++) {
  // Skip multiples of 2
  if (i % 2 === 0) {
    continue
  }
  console.log(i)
}
// 1, 3, 5, 7, 9

The break statement lets you end the loop prematurely, without running any more iterations.

for (let i = 0; i < 10; i++) {
  // End the loop when we get to a multiple of 3
  if (i % 3 === 0) {
    break
  }
  console.log(i)
}
// 1, 2

These two statements work great for individual loops, but what if we needed to coordinate nested loops? If we just used break or continue inside the inner loop, it wouldn’t be able to stop or skip the outer loop.

const numberList = [1, 2, 3, 4, 5]
for (let i = 0; i < numberList.length; i++) {
  const iNum = numberList[i]
  for (let j = 0; j < numberList.length; j++) {
    const jNum = numberList[j]
    if ((iNum * jNum) % 2 === 0) {
      // This continues the inner loop if the number is even
      continue
    }
    console.log(iNum * jNum)
  }
}
// 1,3,5,3,9,15,5,15,25

To let us call continue or break on the outer loop from inside the inner loop, we need to apply a label to the outer loop. The label goes right before the for statement. Then, we can use the label with the continue statement. Notice how the results change once we add the label.

const numberList = [1, 2, 3, 4, 5]
outerLoop: for (let i = 0; i < numberList.length; i++) {
  const iNum = numberList[i]
  for (let j = 0; j < numberList.length; j++) {
    const jNum = numberList[j]
    if ((iNum * jNum) % 2 === 0) {
      // This continues the inner loop if the number is even
      continue outerLoop
    }
    console.log(iNum * jNum)
  }
}
// 1,3,5

Next time you need to nest loops for some reason, you can use a label, break, and continue to have more control over the flow of your loops.


Cool Bits

  1. Just in case you haven’t gotten enough server content in this issue, Abhishek wrote an in-depth intro to server sent events.

  2. Compiled is a build time atomic CSS-in-JS library that’s “baked and ready to go,” just like Grandma’s cookies (or your stoner friend who really wants Taco Bell rn).

  3. TQL is type-safe GraphQL query builder that’s still in pre-production, but looks pretty cool.

  4. Jesse wrote about the things React gets wrong and imagines how they could be improved.

  5. Unclack is a new MacOS app that mutes your microphone while you type during a Zoom call. That way, you can still feel cool for using an 19th-century typewriter ergonomic clacky keyboard, without busting your co-workers eardrums during standup.

  6. Mike used JavaScript to model our expanding universe with a single photon that passes a series of targets placed 200 million light-years apart. Writing that sentence *almost* made me wish I had paid more attention during all those PhysSci 101 lectures.

  7. Synergy is yet another new not-React™ Library. It’s declarative and small and blazing fast and all things that mean good in computer science.