Skip to content

Instantly share code, notes, and snippets.

View iampeterbanjo's full-sized avatar
💭
Error24: not enough hours in the day

Peter Banjo iampeterbanjo

💭
Error24: not enough hours in the day
View GitHub Profile
git config --global merge.tool p4merge
git config --global mergetool.p4merge.path 'C:\Program Files\Perforce\p4merge.exe'
// modified version of http://www.guffa.com/Programming_archive.aspx?id=16
var getQuerystring = function (key, from){
var re = new RegExp('(?:\\?|&)'+key+'=(.*?)(?=&|$)','gi')
, r = []
, m
;
while ((m=re.exec(from)) != null) r.push(m[1]);
return (r.join(',') || '').replace('/','');
// output a warning or message to the console
// depending on how the test passed
function assert(test, description){
console[!!test ? 'log' : 'warn']('Test %s: returned %s', description, test);
}
// i can't remember where I found this
// deep link to modal items
function deepLinkIntoModals() {
// queryStrip
function queryStrip(string) {
string = string.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + string + '=([^&#]*)'),
results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ''));
// https://stackoverflow.com/questions/31077319/regex-get-query-string-without-hash
var parseUri = function (uri){
var anchor = document.createElement('a')
;
anchor.href = uri;
return {
protocol: anchor.protocol
, host: anchor.host
, hostname: anchor.hostname
, port: anchor.port
@iampeterbanjo
iampeterbanjo / app.yaml
Created October 3, 2015 20:39 — forked from darktable/app.yaml
GAE: App.yaml designed for serving a static site on Google App Engine (Python). Copy your static html and files into a folder called "static" next to app.yaml. Contains a bunch of mimetype declarations from html5boilerplate's .htaccess. May not be neces
application: you-app-name-here
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
handlers:
- url: /(.*\.(appcache|manifest))
mime_type: text/cache-manifest
# https://superuser.com/questions/318186/how-do-i-uninstall-google-chrome-completely-from-my-mac
rm -rf ~/Applications/Chrome\ Apps
rm -r /Applications/Google\ Chrome.app/
rm -r ~/Library/Application\ Support/Google/Chrome/
rm ~/Library/Application\ Support/CrashReporter/Google\ Chrome*
rm ~/Library/Preferences/com.google.Chrome*
rm ~/Library/Preferences/Google\ Chrome*
rm -r ~/Library/Caches/com.google.Chrome*
rm -r ~/Library/Saved\ Application\ State/com.google.Chrome.savedState/
// Front-end package.json for
// - compiling sass
// - hot relaod
{
"name": "",
"version": "1.0.0",
"description": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
@iampeterbanjo
iampeterbanjo / wordpress-mysql-phymyadmin-hyper.sh
Last active August 19, 2017 19:18
Create Wordpress, MySQL and phpMyAdmin on hyper.sh using linked docker containers
// FROM https://blog.hyper.sh/hyper_vs_digitalocean_round_1_wordpress_mysql_phpmyadmin.html
//run mysql container
$ hyper run --name mysqldb -e MYSQL_ROOT_PASSWORD=12345678 -d mysql
dedd5369d311ea2de163a04c71961104569e953d90b2424df3e3debaf1ca3d0e
//run phpmyadmin container
$ hyper run --name myadmin -d --link mysqldb:db -p 8888:80 phpmyadmin/phpmyadmin
475e215b02fef05da0eca243b708c578e19372d5efcf7551c2c4a32350633e34
@iampeterbanjo
iampeterbanjo / Make
Created August 30, 2017 04:52
katacoda.com Makefile example for managing Docker images
# katacoda Makefile example for managing Docker images
NAME = benhall/docker-make-demo
default: build
build:
docker build -t $(NAME) .
push:
docker push $(NAME)