Skip to content

Instantly share code, notes, and snippets.

View mrmartineau's full-sized avatar
👋
Aho Young Warrior

Zander Martineau mrmartineau

👋
Aho Young Warrior
View GitHub Profile
@mrmartineau
mrmartineau / authorizationHeader.js
Created May 16, 2018 15:48
setting an authorization header
const USERNAME = 'admin@foobar.com'
const TOKEN = 'hPPacTBSv7k0xAhAJrZjtmrmfhBj6rYd4UVfZvCO'
const authToken = btoa(
unescape(encodeURIComponent(`${USERNAME}:${TOKEN}`))
)
// authToken = 'YWRtaW5AZm9vYmFyLmNvbTpoUFBhY1RCU3Y3azB4QWhBSnJaanRtcm1maEJqNnJZZDRVVmZadkNP'
@mrmartineau
mrmartineau / package.json
Last active May 8, 2018 10:06
Pre-commit stuff
// 1
scripts: {
// ...
"precommit": "lint-staged",
"lint-staged-stash": "git stash save --keep-index 'lint-staged' && touch .didstash || rm .didstash || true",
"lint-staged-stash-pop": "test -f .didstash && rm .didstash && git stash pop || true"
},
"lint-staged": {
"*.js": ["lint-staged-stash", "eslint --fix", "git add", "lint-staged-stash-pop"]
},
@mrmartineau
mrmartineau / .htaccess
Created November 18, 2017 22:32 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@mrmartineau
mrmartineau / bling.js
Created November 18, 2017 22:30 — forked from paulirish/bling.js
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@mrmartineau
mrmartineau / git.sh
Created November 18, 2017 22:15
Various git commands
git push origin --delete branch1 branch2
@mrmartineau
mrmartineau / certificate.sh
Created November 18, 2017 22:30 — forked from WebReflection/certificate.sh
A basic Self Signed SSL Certificate utility
#!/usr/bin/env bash
# A basic Self Signed SSL Certificate utility
# by Andrea Giammarchi @WebReflection
# https://www.webreflection.co.uk/blog/2015/08/08/bringing-ssl-to-your-private-network
# # to make it executable and use it
# $ chmod +x certificate
# $ ./certificate # to read the how-to
@mrmartineau
mrmartineau / getViewportSize.js
Created April 15, 2012 14:26 — forked from scottjehl/getViewportSize.js
Reliably get viewport dimensions in JS
/*!
An experiment in getting accurate visible viewport dimensions across devices
(c) 2012 Scott Jehl.
MIT/GPLv2 Licence
*/
function viewportSize(){
var test = document.createElement( "div" );
test.style.cssText = "position: fixed;top: 0;left: 0;bottom: 0;right: 0;";
Verifying my Blockstack ID is secured with the address 1yEg3gcmHZtHZp2eoFy8UocU3H8dxuKPh https://explorer.blockstack.org/address/1yEg3gcmHZtHZp2eoFy8UocU3H8dxuKPh
@mrmartineau
mrmartineau / detects-flexbox.js
Created March 15, 2016 11:18 — forked from branneman/detects-flexbox.js
Feature detect Flexbox support with JavaScript
define(function() {
var cssomPrefixes = 'Moz O ms Webkit'.split(' ');
var modElem = {
elem: document.createElement('modernizr')
};
var mStyle = {
style: modElem.elem.style
};
@mrmartineau
mrmartineau / rAF.js
Created July 24, 2012 10:23 — forked from paulirish/rAF.js
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller
// fixes from Paul Irish and Tino Zijdel
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {