Skip to content

Instantly share code, notes, and snippets.

View tdammy92's full-sized avatar
:octocat:
Master

Taiwo Damilola tdammy92

:octocat:
Master
View GitHub Profile
@DoctorDerek
DoctorDerek / One-Liner to Use Set with an Array of Objects Unique Objects.js
Created November 4, 2020 19:57
Easy One-Liner to Use Set to Find Unique Objects within an Array of Objects by the Objects' Contents
const uniqueObjectsOneLiner = [
...new Set(objectsArray.map((o) => JSON.stringify(o))),
].map((string) => JSON.parse(string))
console.log(`${uniqueObjectsOneLiner.length} objects`)
// Output: 2 objects
console.log(...uniqueObjectsOneLiner)
// [ { id: 1, emoji: "🎸" }, { id: 2, emoji: "🎷" } ]
@adamthebig
adamthebig / git-commit-log.sh
Created March 17, 2016 21:21
Export commits from a git repo into a pretty spreadsheet (CSV)
git log --pretty=format:'"%h","%an","%aD","%s",' --shortstat --no-merges | paste - - - > log.csv