Skip to content

Instantly share code, notes, and snippets.

on windoze

Drew Lustro drewlustro

on windoze
  • AngelList Talent
  • Los Angeles, CA
  • Twitter @msodrew
View GitHub Profile
PabloSzx / test-esm.mjs
Created Aug 12, 2021
Quick test Node.js ESM
View test-esm.mjs
// Using:
// globby@11.0.4
// chalk@4.1.2
import globby from 'globby';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import chalk from 'chalk';
async function main() {
Neutrollized /
Last active Nov 14, 2022
Installing Ruby with rbenv on MacOS Big Sur

Errors/Problems with Install

In attempting to install Ruby with rbenv, I ran into the following build failures:

BUILD FAILED (macOS 11.2.3 using ruby-build 20210423)

Inspect or clean up the working tree at /var/folders/58/16lnyx815c183j6wzcbl_thc0000gn/T/ruby-build.20210426232453.81982.XfAg0C
Results logged to /var/folders/58/16lnyx815c183j6wzcbl_thc0000gn/T/ruby-build.20210426232453.81982.log

Last 10 log lines:

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
FermiDirak / reactathon2020.js
Created Nov 30, 2020
Learn static code analysis in React!
View reactathon2020.js
import jscodeshift from "jscodeshift";
import fs from "fs";
import path from "path";
const projectDirectory = "my/project/root/directory";
// util functions
rstacruz /
Last active Oct 28, 2022
Setting up Jest with ESM

Setting up Jest with ESM

Here are some different ways on how to set up Jest to support ESM. This applies for Jest v25, Node v13, and Babel v7.

Method A: Native Node.js support

Node v14 and Jest v26 support ESM natively with the --experimental-vm-modules flag.

Install cross-env:

bryant988 / zillow.js
Last active Nov 29, 2022
Zillow Image Downloader
View zillow.js
* NOTE: this specifically works if the house is for sale since it renders differently.
* This will download the highest resolution available per image.
* STEP 1: Make sure to *SCROLL* through all images so they appear on DOM.
* No need to click any images.
somebody32 /
Last active Apr 25, 2022
Tailwind purging + external components library


  1. The app that uses tailwind + external component library (CL) (but not 3rdparty, your company internal one, for example)
  2. The component library also uses tailwind

The goal

To be able to purge safely unused tailwind classes from the build (


The idea here is simple: we're going to purge css on the app side + whitelist classes that component library is using.

MuhsinFatih /
Last active Nov 29, 2022
How to recover from messed up python installation on mac, and never have to mess with apple's shitty python confusion factory

I am assuming you are here because like me, you installed a bazillion different python interpreters on mac and the whole thing is a spagetti. Today, I finally fixed my python installation. Whatever I install for python2 or python3 using pip JUST.WORKS.. My god! finally.

What the hell?

Here is what I had messed up, which you also probably did:

  • I had too many different python interpreters
  • Too many different symlinks which I lost track of
  • almost no package I installed with pip worked without a headache
  • any attempt to fix using online resources made it worse.

Faster Rails tests

Feedback loop speed in one of the biggest contributing factors to overall development time. The faster you get results, the faster you can move on to other things. A fast enough test suite is therefore critical to teams' success, and is worth investing some time at the beginning to save in the long run.

Below is a list of techniques for speeding up a Rails test suite. It is not comprehensive, but should definitely provide some quick wins. This list of techniques assumes you're using minitest, but most everything should translate over to rspec by simply replacing test/test_helper.rb with spec/spec_helper.rb.

drewlustro / Remapkey.bat
Created Aug 1, 2017
Run cmd.exe as administrator in Windows and use this tool to remap any modifier keys to macOS
View Remapkey.bat