This file contains 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
function sleep(milliseconds) { | |
var start = new Date().getTime(); | |
for (var i = 0; i < 1e7; i++) { | |
if ((new Date().getTime() - start) > milliseconds){ | |
break; | |
} | |
} | |
} |
This file contains 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
module.exports = (millis) => { | |
let seconds = (millis / 1000).toFixed(0); | |
let minutes = Math.floor(seconds / 60); | |
let hours = ''; | |
if (minutes > 59) { | |
hours = Math.floor(minutes / 60); | |
hours = (hours >= 10) ? hours : '0' + hours; | |
minutes = minutes - (hours * 60); | |
minutes = (minutes >= 10) ? minutes : '0' + minutes; |
This file contains 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
// Swap keys with values of a javascript object | |
const swapKV = (object) => { | |
const ret = {}; | |
for (let key in object) { | |
if (object.hasOwnProperty(key)) { | |
ret[object[key]] = key; | |
} | |
} | |
return ret; | |
} |
This file contains 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
#!/usr/bin/env bash | |
npm install -g grunt grunt-cli bower yo |
This file contains 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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "centos64" | |
config.vm.box_url = "http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.5-x86_64-v20140110.box" | |
config.vm.network :private_network, ip: "192.168.50.2" |
This file contains 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
#!/bin/bash | |
echo "LC_ALL=C" >> /etc/environment | |
yum -y install git |
This file contains 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
#!/bin/bash | |
cat << 'EOF' >> .bash_profile | |
if [ -n "$SSH_CLIENT" ]; then | |
PS1='\[\033[01;33m\]\u\033[00m\]@\[\033[01;33m\]\h\[\033[00m\]:\[\033[00;33m\]\w\[\033[00m\] ' | |
fi | |
EOF |
This file contains 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
#!/usr/bin/env bash | |
cat << 'EOF' >> /etc/yum.repos.d/mongodb.repo | |
[mongodb] | |
name=MongoDB Repository | |
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/ | |
gpgcheck=0 | |
enabled=1 | |
EOF |
This file contains 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
#!/bin/bash | |
cat << 'EOF' >> ~/.npmrc | |
root = $HOME/.local/lib/node_modules | |
binroot = $HOME/.local/bin | |
manroot = $HOME/.local/share/man | |
EOF | |
mkdir -p ~/.local |
This file contains 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
while [ "$1" != "" ]; do | |
echo $1 | |
shift | |
done |