This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var isDivisibleBy13 = function(test) { | |
if (Math.abs(test) === 13 || test % 13 === 0) { | |
return true; | |
} | |
var lastDigit = +String(number).slice(-1), | |
remainingDigits = +String(test).slice(0, -1); | |
if (test >= 13 && (remainingDigits - (lastDigit * 9)) % 13 === 0) { | |
return isDivisibleBy13(remainingDigits); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The following packages are needed during `make` on Ubuntu | |
sudo apt-get install libssl-dev libtool autoconf automake build-essential python-dev | |
# The rest is just instructions from | |
# https://codeyarns.com/2015/02/10/how-to-install-and-use-watchman/ | |
git clone https://github.com/facebook/watchman.git | |
cd watchman | |
git checkout v4.9.0 # latest version | |
./autogen.sh | |
./configure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"prettier": { | |
"arrowParens": "always", | |
"bracketSpacing": true, | |
"jsxBracketSameLine": true, | |
"printWidth": 90, | |
"semi": true, | |
"singleQuote": true, | |
"tabWidth": 2, | |
"trailingComma": "es5", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run with | |
# bash <(curl -s https://gist.githubusercontent.com/iampeterbanjo/f1c9931002f5a939464c172fed6f96cb/raw/520cee811a47714291394dec5fb4352683a17158/install-modprobe-ubuntu-kernel.sh) | |
apt-get update | |
apt-get install build-essential libssl-dev | |
apt-get install -y libssl-dev | |
apt-get install -y zfsutils-linux # will fail on dkms | |
# Determine versions | |
arch="$(uname -m)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt install lxd zfs zfsutils-linux | |
groups | |
newgrp lxd | |
sudo lxd init | |
juju bootstrap localhost lxd-controller |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt install zfs-dkms | |
sudo modprobe zfs | |
# replace 0.6.5.6 with your version of zfs | |
dkms remove -m zfs -v 0.6.5.6 --all | |
dkms remove -m spl -v 0.6.5.6 --all | |
dkms add -m spl -v 0.6.5.6 | |
dkms add -m zfs -v 0.6.5.6 | |
dkms install -m spl -v 0.6.5.6 | |
dkms install -m zfs -v 0.6.5.6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget -nv -O - https://get.docker.com/ | sh | |
# setup dokku apt repository | |
wget -nv -O - https://packagecloud.io/gpg.key | apt-key add - | |
export SOURCE="https://packagecloud.io/dokku/dokku/ubuntu/" | |
echo "deb $SOURCE trusty main" | tee /etc/apt/sources.list.d/dokku.list | |
apt-get update | |
# install dokku | |
apt-get install dokku |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create new user, user directory and use bash shell | |
sudo useradd -m $1 -s /bin/bash | |
# add user to sudo group | |
usermod -a -G sudo $1 | |
# use root ssh key for this user | |
mkdir -p /home/$1/.ssh | |
touch /home/$1/.ssh/authorized_keys | |
cat ~/.ssh/authorized_keys >> /home/$1/.ssh/authorized_keys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// setup test environment for jest and jsdom to | |
// allow code like window.location.href = '/' | |
// # setupEnvironment.js | |
const JSDOMEnvironment = require('jest-environment-jsdom'); | |
module.exports = class JSDOMEnvironmentGlobal extends JSDOMEnvironment { | |
constructor(config) { | |
super(config); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "node-api", | |
"version": "0.0.1", | |
"description": "Node API", | |
"keywords": ["Node.js", "API"], | |
"dependencies": { | |
"axios": "^0.16.2", | |
"cors": "^2.8.4", | |
"dotenv": "^4.0.0", | |
"express": "^4.15.3", |