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
#!/usr/bin/bash | |
# crontab -e | |
# 1 */2 * * * /home/martin/push-homesick-castles.sh dotfiles > /dev/null 2>&1 | |
if [ $# -eq 0 ] | |
then | |
echo "Usage $0 castle1[, castle2, castle3, ...]" | |
exit 1 | |
fi | |
for castle in "$@" | |
do |
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
export function formatBytes(bytes, decimals = 2, format = 'KB') { | |
if (bytes < 1) { | |
return '0 B'; | |
} | |
const k = format === 'kB' ? 1000 : 1024; | |
const i = Math.floor(Math.log(bytes) / Math.log(k)); | |
const sizes = ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y']; | |
const suffix = [format === 'kB' ? sizes[i].toLowerCase() : sizes[i], 'B']; | |
if (format === 'KiB') { | |
suffix.splice(1, 0, 'i'); |
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
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
use Illuminate\Http\Request; | |
class CustomHMRHotFile | |
{ | |
/** |
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
/** | |
* minify all files matched by given glob pattern through terser. Requires `glob` to be installed: | |
* | |
* npm i glob --save-dev | |
* | |
* Place the scripts in your projects scripts folder, then add it to your package.json's scripts like this | |
* | |
* "mterser": "node scripts/mterser.js --glob dist/umd/*.js --compress --mangle --comments false", | |
* | |
* and run it by calling `npm run mterser`. A `terser` npm script should also be available, see `--terser-cmd` below. |
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
apt-get install -y libssl-dev libreadline-dev zlib1g-dev | |
# install missing deps on mark's vagrant basebox to avoid fail at 99% :D | |
cd | |
git clone git://github.com/sstephenson/rbenv.git .rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc | |
echo 'eval "$(rbenv init -)"' >> ~/.bashrc | |
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc | |
source ~/.bashrc | |
rbenv install -v 2.2.3 |