Skip to content

Instantly share code, notes, and snippets.

@konstantin-hatvan
konstantin-hatvan / readdirRecursive.js
Created February 16, 2020 09:23
Recursive fs.readdir with relative file paths
const path = require('path');
const fs = require('fs');
/* Prepend the given path segment */
const prependPathSegment = pathSegment => location => path.join(pathSegment, location);
/* fs.readdir but with relative paths */
const readdirPreserveRelativePath = location => fs.readdirSync(location).map(prependPathSegment(location));
/* Recursive fs.readdir but with relative paths */
# variation of https://gist.github.com/johanmeiring/3002458
# Changes order of output tokens so that the commit messages all start at the same line depth
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset %s %C(yellow)%d%Creset %Cgreen(%cr)%Creset %C(bold blue)<%an>%Creset' --abbrev-commit --"