Knowing your way around the commnand line has many benefits. With a bit of practice, you can accomplish many tasks much faster on the command line than using any other tool.
The command line is almost always available, unlike some GUI tools that must be installed. …
Git is a powerful tool. Once you’ve mastered
merge, there are endless possibilities. A very useful one is
git-bisect. It helps you find a commit that introduced a certain change in behavior.
When you find a regression, something broken that used to work, use
git-bisect to find the commit that broke it. …
The problem: Given an unsorted array of numbers, find the maximum difference between the successive elements in its sorted form. The numbers can be negative or decimals.
const maxGap = input =>
.sort((a, b) => a — b)
.reduce((acc, cur, idx, src) =>
Math.max(acc, idx > 0 ? cur — src[idx — 1] : 0), 0);
This function first sorts the inputs. Resulting in
[9, 17, 21, 28, 41, 45] for our example. Next, it iterates over the sorted array and keeps track of the maximum difference in the accumulator variable:
Why do we sometimes use bare double dashes in commands like
git checkout -- file.txt? Isn’t
git checkout file.txt just as good?
Bare double dashes signify the end of options. Anything after
-- is a parameter. For example in git, you can checkout a file named
git checkout master # Checkout the master branch
git checkout -- master # Checkout the file named master
In proper documentation, we see
git checkout -- file.txt when
git checkout file.txt would work, too.
-- safeguards against checking out branches when files have the same name as branches.
Sometimes you need to work on application code and a dependency at the same time. You might be the author of a dependency and don’t have good test coverage yet. The application can serve as an end-to-end test for the dependency. Maybe you need to debug an issue in your application and the problem seems to be in the dependency sources.
You could make changes in
node_modules and manually copy the changes to the
git repository of the dependency once you are done. But there is a much cleaner approach:
Package linking is a two-step process:
npm link. A symlink, short for symbolic link, is a shortcut that points to another directory or file on your system. …
This article is available in Chinese.
Smis, small integers. This article digs into V8’s source code to discover how large
Smis actually are.
I recently switched teams and have a fancy new title now: Cloud Developer Programs Engineer, short DPE. What’s that you ask? Well, I had to ask, too.
DPEs are at the intersection of Developer Advocacy, Technical Writing, Product Management, and Engineering.
We are engineers in Developer Relations in Google Cloud. …
Google Compute Engine delivers virtual machines (VMs). Compute Engine supports scaling from single instances to global, load-balanced cloud computing.
On Compute Engine VMs, you can install any operating system or software and you have full control over the firewall. A Compute Engine VM is like your local workstation, except that it lives in the cloud. You can easily scale to more or fewer VMs at any moment as needed.
The easiest way to get started with Compute Engine is through the Cloud Console. You can configure and run virtual machines in the UI.
But what if you want to automate the process of configuring and running VMs? That’s where the Compute Engine API comes in handy. It is a REST API for managing virtual machines on Google Cloud Platform. The
@google-cloud/compute Client Library for Node reduces the amount of code you need to write and makes your application more robust. It’s easy to manage your VMs programmatically with Node. …
Nothing to do over the holidays? Read these inspiring blogs about software development. Listed in alphabetical order.
Julia Evans writes about Linux and How to teach technical concepts with cartoons. If anybody knows how to do that, it’s her, because she has published eight zines about systems and debugging tools. …
If your Node app’s sole purpose is to compute prime numbers and you don’t want to use a fast lookup table, please rely on this benchmark 100%. …