Instantly share code, notes, and snippets.

View fizzbuzz.go
package main
import "fmt"
const (
FIZZ = 3
BUZZ = 5
FIZZBUZZ = 15
)
View setup.md

Using XDebug in Atom Editor

Install the XDebug plugin for Atom and then add the following to the config.cson file (Atom > Config…):

"php-debug":
  PathMaps: [
    "remotepath;localpath"
    "/server/path/to/project/;/local/path/to/project/"
  ]
  ServerPort: 9001
View install.sh
#!/usr/bin/env bash
brew tap homebrew/homebrew-php
brew install php71
cd ~/.atom/packages/php-integrator-base/core
/usr/local/bin/php ./composer.phar create-project php-integrator/core ./3.0.0 3.0.0 --prefer-dist --no-dev
View convert_video.sh
#!/usr/bin/env bash
# Convert MKV to MP4
# Uses Docker FFMpeg, FFMpeg or AVConv.
#
# Usage:
# ./convert_video.sh
# ./convert_video.sh /path/to/videos
#
# Notes:
View include-me-func.php
<?php
// Use a closure so nothing leaks out when included.
return (function () {
$array = ['foo', 'bar'];
foreach ($array as $string) {
// Some exciting logic.
}
return 'FOOBAR';
View install.sh
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
View reloadvhosts.sh
# Symlink web server virtualhost configutions into the sites-enabled directory.
# Usage: reloadvhosts /path/to/websites
# reloadvhosts /path/to/websites *-live.conf
# reloadvhosts /path/to/websites apache2
reloadvhosts() {
local vhost_dir=${1:-/var/www/vhosts}
local conf_name=${2:-*dev.conf}
local web_server=${3:-nginx}
sudo find /etc/$web_server/sites-enabled/ -type l -exec rm {} \;
View amd-audio-fix.md

Fix AMD HDMI audio lost after monitor standby

The quickest solution to this issue is to disable and then re-enable the AMD High Definition Audio Device in the Device Manager. However it's possible to create a handy desktop shortcut:

Download DevManView and put the files in C:\Program Files\NirSoft.

Create a file called Restart AMD Audio.bat on the desktop with the following contents:

"C:\Program Files\NirSoft\DevManView.exe" /disable_enable "AMD High Definition Audio Device"
View raspberry-pi-3.md
View fix-osx-wifi-battery-drain.md

Fix OSX battery draining on sleep due to wifi activity

Install SleepWatcher using Homebrew:

sudo chown -R $(whoami) /usr/local
brew update
brew install sleepwatcher

Start the SleepWatcher service: