Skip to content

Instantly share code, notes, and snippets.

@ihaveaproblem
ihaveaproblem / unique.js
Created February 21, 2019 10:22 — forked from thomasmichaelwallace/unique.js
Getting unique values using sets in ES6.
// with arrays
const dupArr = [1, 1, 2, 3, 1];
const uniArr = [...(new Set(dupArr))];
// [1, 2, 3]
// with objects on a key.
const dupObj = [{ id: 1, value: 'a' }, { id: 2, value: 'b' }, { id: 1, value: 'c' }];
const uniKeys = [...(new Set(dupObj.map(({ id }) => id)))];
// [ '1', '2' ]
@ihaveaproblem
ihaveaproblem / Git Cheat Sheet
Created October 22, 2015 08:25 — forked from ramesaliyev/Git Cheat Sheet
Git Cheat Sheet
- Create a repository
git init <repo-name>
git clone <url> <directory-name>
git clone -o <remote-name> <url>
- Commiting
git add <filename>
git commit -m "Commit Message"
git commit -am "Commit Message"