Instantly share code, notes, and snippets.

🎯
Focusing

# Hasnain BukhariBukhariH

🎯
Focusing
• Sort options
Created Dec 3, 2019 — forked from gtallen1187/slope_vs_starting.md
A little bit of slope makes up for a lot of y-intercept
View slope_vs_starting.md

### "A little bit of slope makes up for a lot of y-intercept"

01/13/2012. From a lecture by Professor John Ousterhout at Stanford, class CS140

Here's today's thought for the weekend. A little bit of slope makes up for a lot of Y-intercept.

[Laughter]

Created Aug 17, 2018
Checks if a BigDecimal is with in a tolerance value
View BigDecimal_Tolerance.java
 private static boolean isWithinTolerance(BigDecimal amount, BigDecimal tolerance) { return (amount.compareTo(tolerance.negate()) > 0 && amount.compareTo(tolerance) < 0) || amount.abs().compareTo(tolerance) == 0; }
Created Jun 6, 2018
Get dates between two moment objects
View MomentBetweenDates.js
 enumerateDaysBetweenDates = (startDate, endDate) => { const now = startDate.clone().startOf("day"); const dates = []; while (now.isSameOrBefore(endDate.startOf("day"))) { dates.push(now.format("YYYY-MM-DD")); now.add(1, "days"); } return dates; };
Created Jun 6, 2018
Get dates between two moment objects
View MomentBetweenDatesjs
 enumerateDaysBetweenDates = (startDate, endDate) => { const now = startDate.clone().startOf("day"); const dates = []; while (now.isSameOrBefore(endDate.startOf("day"))) { dates.push(now.format("YYYY-MM-DD")); now.add(1, "days"); } return dates; };
Created Dec 4, 2017
Simple ES6 Logger
View SimpleLogger.js
 const logger = (() => { let log = ""; return { add: msg => log += msg + "\n", show: () => console.log(log) } })();
Created Nov 21, 2017
View Unique Values Only Array.js
 // Turns [1,2,2,2] into [1,2] const arr = [1,2,2,2] [...new Set(arr)]
Created Oct 13, 2017
View keybase.md

### Keybase proof

I hereby claim:

• I am bukharih on github.
• I am bukharih (https://keybase.io/bukharih) on keybase.
• I have a public key whose fingerprint is 5C4D 1BD3 7DEA 43CA D54C 633C E04C F879 7C01 7AE5

To claim this, I am signing this object:

Created Oct 9, 2017
Delete All Node Modules via Term
View Delete All Node Modules.sh
 find . -name "node_modules" -exec rm -rf '{}' +
Created Sep 28, 2017
Merge Last Two Commits
View Merge Last Two Commits.sh
 git reset --soft "HEAD^" git commit --amend
Last active Sep 6, 2017
Get unique properties from JSON object
View uniqueProperties.js
 // Turn const ARRAY = [{type: "FOO", content: "Test 0"}, {type: "BAR", content: "Test 1"}, {type: "FOO", content: "Test 2"}] // Into ["FOO", "BAR"] // Using getUniqueProperties(ARRAY, 'type') getUniqueProperties = (array, property)=>{ return [...new Set(array.map(elem => elem[property]))] }
You can’t perform that action at this time.