Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthew Hartman matthewhartman

View GitHub Profile
@matthewhartman
matthewhartman / format-commas.js
Created Jan 13, 2021 — forked from patik/format-commas.js
Format number with commas
View format-commas.js
// Converts `1234567` => `"1,234,567"
// Does not support decimals yet
function formatNumberWithCommas (number) {
return ('' + number) // Convert to a string
.split('').reverse().join('') // Reverse the order of the characters (which are all digits at this point)
.replace(/(...)/g, '$1,') // Insert a comma after every three digits
.split('').reverse().join('') // Un-reverse the characters
.replace(/^,/, ''); // Remove any commas that were added to the beginning (i.e. if the number of digits was a multiple of three)
};
View install-latest-curl-on-linux.markdown

Download CURL from the following

https://curl.se/download.html

tar xzvf curl-7.68.0.tar.gz
cd curl-7.68.0
./configure --with-ssl
make
sudo make install
View divider.js
const divider = Array(20).join('-');
// output
// --------------------
View install-firefox-on-linux-debian.markdown

Install Firefox on Debian

Download firefox binary firefox-80.0.1.tar.bz2 and extract contents into /opt/ directory

sudo tar -xf firefox-*.tar.bz2 /opt/

Create symlink

View fix-crackling-for-pulseaudio-linux.markdown

Fix Pulse Audio Crackling in Linux

sudo nano /etc/pulse/default.pa

Find the following line:

load-module module-udev-detect
View running-docker-on-ubuntu-windows-subsystem.markdown

Running Docker on Ubuntu WSL

Configure Docker for Windows (Docker Desktop)

Windows Docker Settings

Install Docker in Ubuntu WSL

Update the apt package list

View install-yarn-linux-debian.markdown

Installing Yarn on Debian

Import the repository's GPG key

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -

Enable the Yarn APT repository

View install-maven-linux-debian.markdown
View install-java-jdk-linux-debian.markdown

Install Java JDK On Linux (Debian)

First install the directory where the JDK binary will live

sudo mkdir -p /usr/lib/jvm

Download and extract binary (use login)

View docker-linux.markdown