Instantly share code, notes, and snippets.

View aupostcode2state.js
function returnState(postcode) {
var postcode = parseInt(postcode, 10);
if ((postcode >= 1000 && postcode <=1999) || (postcode >= 2000 && postcode <= 2599) || (postcode >=2619 && postcode <= 2899) || (postcode >= 2921 && postcode <= 2999)){
return 'NSW';
} else if ((postcode >= 200 && postcode <= 299) || (postcode >= 2600 && postcode <= 2618) || (postcode >= 2900 && postcode <= 2920)) {
return 'ACT';
} else if ((postcode >= 3000 && postcode <= 3999) || (postcode >= 8000 && postcode <= 8999)) {
return 'VIC';
} else if ((postcode >= 4000 && postcode <= 4999) || (postcode >= 9000 && postcode <= 9999)) {
return 'QLD';
View wget
wget --recursive --no-clobber --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains webthemez.com --no-parent https://webthemez.com/demo/custom-best-interior-design-website-template/
View gist:2075589367aa526cce6ef0aaf68aba75
sass-convert -F scss -T sass application_styles.css.scss application_styles.css.sass
View post.go
package main
import (
"fmt"
"net/http"
"net/url"
"strconv"
"strings"
)
View bash.sh
wget https://github.com/phpredis/phpredis/archive/develop.zip
unzip develop.zip
cd phpredis-develop/
/usr/local/php70/bin/phpize
./configure --with-php-config=/usr/local/php70/bin/php-config
make && make install
/usr/local/php70/lib/php.conf.d/
cp 10-opcache.ini 10-redis.ini
View caddy.conf
pricewatch.io www.pricewatch.io 104.198.194.205 {
#startup service php70-php-fpm start
#shutdown service php70-php-fpm stop
expires {
match .css$ 1m # expires
match .js$ 1m # expires
match .png$ 1m # expires
match .jpg$ 1m #expires # expires
match .webp$ 1m
View rename.sh
for f in *.png; do echo mv "$f" "${f/_*_/_}"; done
View move.sh
find ./ -name '*.JPG' -exec cp {} /Volumes/NO\ NAME/2014 \;
View main.go
package main
import (
"fmt"
"github.com/rwcarlsen/goexif/exif"
"io/ioutil"
"os"
"path"
"path/filepath"
)