Skip to content

Instantly share code, notes, and snippets.

@ZacharyRSmith
ZacharyRSmith / oh-js.md
Last active April 18, 2016 05:38
I found the following surprising while looking into JavaScript's equality/comparisons:
console.log(
       ['foo'] != ['foo']
    && ['foo'] <= ['foo']
    && ['foo'] >= ['foo']);
// -> true

The Rabbit Hole.

This post is for people using a bash shell. I'm assuming you know about bash aliases and Sublime Text snippets. They make your life a lot easier. I'm also assuming you're like me: you're too lazy to set them up--at least the old-fashioned way. Let me show you how to make setting these up easier.

You can set up a bash alias with a command as easy as:

als gitpfom git\ push\ -f\ origin\ master

Bam. Your alias is made and ready to go:

All code is in JavaScript, but the technique discussed is applicable to many languages.

50% of "else" statements are unnecessary. Not only that, they also increase bugs and decrease readability and maintainability. A coding technique to counter this is "guard clauses". Using them has the following benefits:

  • Thinking in terms of guard clauses instead of if/else puts you in a frame of mind where you are more likely to catch bugs.
  • This pattern increases code readability (and thus maintainability)
  • It Keeps Code Left, which again increases readability
@ZacharyRSmith
ZacharyRSmith / descriptor-pattern.js
Created March 18, 2018 21:01
descriptor pattern
const assert = require('assert');
class Descriptor {
set(instance, value) {
instance[this.name] = value;
}
}
class Grade extends Descriptor {
set(instance, value) {
if (!(0 <= value && value <= 100)) throw new Error(`Value must be between 0 and 100 but was "${value}".`);

How to Interview Software Engineers

Why this article? "The engineer interviewing process is broken." One reason is that the assessments most commonly used predict much worse than the best assessments. This post discusses common assessments and their better alternatives.

When interviewing someone, you want to:

  • predict if they would be a fit,
  • predict if they meet your hiring bar, and
  • give them a positive experience.

Giving them a positive experience is important even if you decide against offering them a position. However, this article focuses on how to predict if they meet your hiring bar.

@ZacharyRSmith
ZacharyRSmith / xps13_9360_ubuntu16.04.md
Last active January 13, 2022 22:18 — forked from achiang/xps13_9360_ubuntu16.04.md
Dell XPS 13 + Ubuntu 20.04: fixing papercuts

Upfront