Skip to content

Instantly share code, notes, and snippets.

View sam-rad's full-sized avatar

Sam sam-rad

View GitHub Profile
@sam-rad
sam-rad / wildcard-domain-url.js
Created October 24, 2019 17:22
Wildcard URL parsing in node, chrome and firefox
// Chrome
new URL('https://*.bee.com');
// URL {
// hash: ""
// host: "%2A.bee.com" // <= Escaped
// hostname: "%2A.bee.com"
// href: "https://%2A.bee.com/"
// origin: "https://%2A.bee.com"
// password: ""
// pathname: "/"
@sam-rad
sam-rad / .zshrc
Last active June 5, 2019 17:10 — forked from bmhatfield/.zshrc
OSX Keychain Environment Variables
# If you use bash, this technique isn't really zsh specific. Adapt as needed.
source ~/keychain-environment-variables.sh
# AWS configuration example, after doing:
# $ set-keychain-environment-variable AWS_ACCESS_KEY_ID
# provide: "AKIAYOURACCESSKEY"
# $ set-keychain-environment-variable AWS_SECRET_ACCESS_KEY
# provide: "j1/yoursupersecret/password"
export AWS_ACCESS_KEY_ID=$(keychain-environment-variable AWS_ACCESS_KEY_ID);
export AWS_SECRET_ACCESS_KEY=$(keychain-environment-variable AWS_SECRET_ACCESS_KEY);
@sam-rad
sam-rad / hnl.mobileConsole.js
Created March 27, 2018 19:52 — forked from c-kick/hnl.mobileConsole.js
hnl.mobileConsole.js - extends JavaScript's console to display a visual console inside the webpage. Very usefull for debugging JS on mobile devices with no real console. Info and demo: http://www.hnldesign.nl/work/code/mobileconsole-javascript-console-for-mobile-devices/
/*!
* hnl.mobileConsole - javascript mobile console - v1.2.6 - 26/10/2016
* Adds html console to webpage. Especially useful for debugging JS on mobile devices.
* Supports 'log', 'trace', 'info', 'warn', 'error', 'group', 'groupEnd', 'table', 'assert', 'clear'
* Inspired by code by jakub fiala (https://gist.github.com/jakubfiala/8fe3461ab6508f46003d)
* Licensed under the MIT license
*
* Original author: @hnldesign
* Further changes, comments: @hnldesign
* Copyright (c) 2014-2016 HN Leussink
@sam-rad
sam-rad / shuffle.js
Created June 16, 2017 23:08
shuffles an array
const shuffle = (arr, result=[], idx) =>
arr.length <= 0
? result
: (idx = Math.floor(Math.random() * arr.length),
shuffle(arr.filter((_, i) => i !== idx), [ ...result, arr[idx]]));
<div id="app"></div>
@sam-rad
sam-rad / inset_input.css
Created September 22, 2016 05:35 — forked from nrrrdcore/inset_input.css
The Perfect Inset Input CSS
input {
height: 34px;
width: 100%;
border-radius: 3px;
border: 1px solid transparent;
border-top: none;
border-bottom: 1px solid #DDD;
box-shadow: inset 0 1px 2px rgba(0,0,0,.39), 0 -1px 1px #FFF, 0 1px 0 #FFF;
}