Skip to content

Instantly share code, notes, and snippets.

Genovo /
Created Mar 29, 2021 — forked from branneman/
Better local require() paths for Node.js

Better local require() paths for Node.js


When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions


Folder Structure


  • Clear feature ownership
  • Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
Genovo / proxyTrack.js
Created Dec 19, 2019 — forked from mrharel/proxyTrack.js
Using Proxy to Track Javascript Class
View proxyTrack.js
const callerMap = {};
function getCaller(error) {
if (error && error.stack) {
const lines = error.stack.split('\n');
if (lines.length > 2) {
let match = lines[2].match(/at ([a-zA-Z\-_$.]+) (.*)/);
if (match) {
return {
name: match[1].replace(/^Proxy\./, ''),
Genovo /
Created May 28, 2019 — forked from lopes/
A DNS propagation checker in Shell Script.
# A DNS propagation checker. Fetches in many DNS servers around
# the world for IPs assigned to a given domain.
# Author: José Lopes de Oliveira Júnior <>
Genovo / unary.js
Last active Feb 25, 2018
“Unary” is a function decorator that modifies the number of arguments a function takes: Unary takes any function and turns it into a function taking exactly one argument.
View unary.js
const unary = (fn) =>
fn.length === 1
? fn
: function (something) {
return, something)
['1', '2', '3'].map(unary(parseInt))
//=> [1, 2, 3]
Genovo / swa11-6.py3
Created Oct 22, 2017
Shortcut for SWA Fare Lookup-hardcoded Airports
View swa11-6.py3
#Southwest Air Fare Searcher
#Default Aiports:
departureAirportCode = "LAX"
arrivalAirportCode = "SJC"
Genovo /
Created Sep 13, 2017
Bash "Strict Mode"
set -euo pipefail