Skip to content

Instantly share code, notes, and snippets.

@konstantin-hatvan
konstantin-hatvan / readdirRecursive.js
Created Feb 16, 2020
Recursive fs.readdir with relative file paths
View readdirRecursive.js
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 */
View gitlg.sh
# 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 --"