Skip to content

Instantly share code, notes, and snippets.

@letsgetrandy
letsgetrandy / orphan
Last active November 19, 2021 19:11
Bash script for finding and deleting orphaned files. Works best with the Silver Searcher (https://github.com/ggreer/the_silver_searcher). Works well with ack (http://beyondgrep.com/). Works okay with grep, but you're not really still using grep, are you? Using ag or ack allows you to respect your config files and ignore files you don't want to s…
#! /bin/bash
#
# USAGE:
# orphan [-dv] filename
#
# OPTIONS:
# -d delete the file if it is an orphan
# -f force (ie, don't prompt)
# -h display help text
# -v verbose
@brianloveswords
brianloveswords / git-obliterate
Last active January 24, 2024 12:28
git-obliterate: for removing sensitive files you may have committed from the entire history of the project.
#!/bin/bash
file=$1
test -z $file && echo "file required." 1>&2 && exit 1
git filter-branch -f --index-filter "git rm -r --cached $file --ignore-unmatch" --prune-empty --tag-name-filter cat -- --all
git ignore $file
git add .gitignore
git commit -m "Add $file to .gitignore"

Important: At the time of writing (2019-11-11) Immutable.js is effectively abandonware, so I can no longer recommend anyone to follow the advice given here. I'll leave the article here for posterity, since it's still getting some traffic.

Understanding Immutable.Record

Functional programming principles and with it immutable data are changing the way we write frontend applications. If the recent de-facto frontend stack of React and Redux feels like it goes perfectly together with immutable data, that's because it's specifically designed for that.

There's several interesting implementations of immutable data for JavaScript, but here I'll be focusing on Facebook's own Immutable.js, and specifically on one of i