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
@iampeterbanjo
iampeterbanjo / package.lint.test.json
Last active January 19, 2018 13:52
package.json snippet with jest test runner, prettier formatter and eslint
{
"prettier": {
"arrowParens": "always",
"bracketSpacing": true,
"jsxBracketSameLine": true,
"printWidth": 90,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
@iampeterbanjo
iampeterbanjo / install-watchman.bash
Last active January 15, 2018 16:29 — forked from davidmason/install-watchman.bash
To install watchman on Fedora 26, these are all the hoops I had to jump through.
# The following packages are needed during `make` on Ubuntu
sudo apt-get install libssl-dev libtool autoconf automake build-essential python-dev
# The rest is just instructions from
# https://codeyarns.com/2015/02/10/how-to-install-and-use-watchman/
git clone https://github.com/facebook/watchman.git
cd watchman
git checkout v4.9.0 # latest version
./autogen.sh
./configure
@iampeterbanjo
iampeterbanjo / isDivisibleBy13.js
Created November 16, 2017 18:19
Math for testing numbers divisible by 13
var isDivisibleBy13 = function(test) {
if (Math.abs(test) === 13 || test % 13 === 0) {
return true;
}
var lastDigit = +String(number).slice(-1),
remainingDigits = +String(test).slice(0, -1);
if (test >= 13 && (remainingDigits - (lastDigit * 9)) % 13 === 0) {
return isDivisibleBy13(remainingDigits);
}
@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)
@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
// Front-end package.json for
// - compiling sass
// - hot relaod
{
"name": "",
"version": "1.0.0",
"description": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
# 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/
@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://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
// 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, ''));