Skip to content

Instantly share code, notes, and snippets.

@branneman
branneman / better-nodejs-require-paths.md
Last active June 12, 2024 02:40
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

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

@adamwg
adamwg / nmnotify.py
Created March 1, 2012 19:28
inotify for notmuch
# Example: loops monitoring events forever.
#
import pyinotify
from os import system
from time import sleep
def run_nm(notifier):
sleep(1)
system("notmuch new")
return False