Skip to content

Instantly share code, notes, and snippets.

View indefinitelee's full-sized avatar

Lee Wilson indefinitelee

View GitHub Profile
@indefinitelee
indefinitelee / main.js
Created September 13, 2018 17:56
SereneExemplaryConference created by indefinitelee1 - https://repl.it/@indefinitelee1/SereneExemplaryConference
const dollarFormat = (amount, defaultValue) => {
console.log(amount)
if (!amount)
return defaultValue;
const result = `${parseFloat(amount).toFixed(2)}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
console.log(result)
if (isNaN(result))
return defaultValue
else
@indefinitelee
indefinitelee / main.js
Created September 13, 2018 17:55
SereneExemplaryConference created by indefinitelee1 - https://repl.it/@indefinitelee1/SereneExemplaryConference
const dollarFormat = (amount, defaultValue) => {
console.log(amount)
if (!amount)
return defaultValue;
const result = `${parseFloat(amount).toFixed(2)}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
console.log(result)
if (isNaN(result))
return defaultValue
else
@indefinitelee
indefinitelee / main.js
Created June 16, 2018 17:15
MajorLikableCases created by indefinitelee1 - https://repl.it/@indefinitelee1/MajorLikableCases
const uniqSort = function(arr) {
const memo = {[arr[0]] : true};
const result = [arr[0]];
for (let i = 1; i < arr.length; i++) {
if (!memo[arr[i]]) {
result.push(arr[i]);
memo[arr[i]] = true;
}
}
@indefinitelee
indefinitelee / protips.js
Created March 29, 2017 03:41 — forked from nolanlawson/protips.js
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@indefinitelee
indefinitelee / migrate_postgresql_database.md
Created February 18, 2017 04:44 — forked from olivierlacan/migrate_postgresql_database.md
How to migrate a Homebrew-installed PostgreSQL database to a new major version (9.3 to 9.4) on OS X

This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.

First let's check something.

brew info postgresql

The top of what gets printed as a result is the most important: