Skip to content

Instantly share code, notes, and snippets.

Lee Wilson indefinitelee

Block or report user

Report or block indefinitelee

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@indefinitelee
indefinitelee / main.js
Created Sep 13, 2018
SereneExemplaryConference created by indefinitelee1 - https://repl.it/@indefinitelee1/SereneExemplaryConference
View main.js
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 Sep 13, 2018
SereneExemplaryConference created by indefinitelee1 - https://repl.it/@indefinitelee1/SereneExemplaryConference
View main.js
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
View main.js
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 Mar 29, 2017 — forked from nolanlawson/protips.js
Promise protips - stuff I wish I had known when I started with Promises
View protips.js
// 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 Feb 18, 2017 — 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
View migrate_postgresql_database.md

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:

You can’t perform that action at this time.