Skip to content

Instantly share code, notes, and snippets.

View mfjohansson's full-sized avatar
👋

Magnus mfjohansson

👋
View GitHub Profile
@mfjohansson
mfjohansson / scripts.md
Created May 15, 2018 06:44
Activate apache and install MySQL
mkdir ~/Sites
@mfjohansson
mfjohansson / httpd-vhosts.conf
Created May 15, 2018 06:42
/private/etc/apache2/extra
<Directory "/Users/magnus/Sites">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Virtualhost *:80>
VirtualDocumentRoot "/Users/magnus/Sites/%0/public"
ServerName sites.test
ServerAlias *.test
@mfjohansson
mfjohansson / dnsmasq OS X.md
Last active May 15, 2018 06:29 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install

<p><video style="width:100%" controls=""><br><source src="/sites/default/files/bergvik_sommar_20_640x360.mp4" type="video/mp4"><br></video></p>
@mfjohansson
mfjohansson / networking.sh
Created December 17, 2014 14:22
Useful commands
# Restart DNSMASQ
# When changes has been made to /etc/hosts - run this
sudo kill -HUP $(pgrep dnsmasq)
@mfjohansson
mfjohansson / 1-nodejs.sh
Last active August 29, 2015 14:05
mean.io production
##### Install node.js
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install nodejs
@mfjohansson
mfjohansson / parseTime.js
Last active December 18, 2015 07:48
Parse time from a string, result in minutes. E.g.: `5h 30 m` `1d2h45m` `2 hours, 45 mins`
function parseTime(inp) {
return eval(inp.replace(/(secs|second|seconds)/gi, "s").replace(/(mins|minute|minutes)/gi, "m").replace(/(hour|hours)/gi, "h").replace(/(day|days)/gi, "d").replace(/(week|weeks)/gi, "w").replace(/[^0-9hdwms]/gi, "").replace(/([a-z])/gi, "$1+").replace("h", "*60").replace("d", "*60*8").replace("w", "*60*8*5").replace("m", "*1").replace("s", "/60") + "-0");
}