Skip to content

Instantly share code, notes, and snippets.

View mgrahamjo's full-sized avatar

Mike Johnson mgrahamjo

View GitHub Profile
function FindProxyForURL(url, host) {
if (shExpMatch(host, "*.proxysmith.test")) {
return "PROXY proxysmith.test";
}
return "DIRECT";
}
@mgrahamjo
mgrahamjo / clean-git-branches.sh
Created August 24, 2021 15:44
Deletes all local branches that have been pushed to the remote
git branch -r | grep -v origin/main | sed 's#origin/##' | xargs git branch -D 2>/dev/null
@mgrahamjo
mgrahamjo / example.com
Created April 15, 2018 22:06
Basic nginx sites-available conf for node reverse proxy + gzipped static files; external https rewrites assumed (i.e. cloudflare)
server {
server_name example.com;
return 301 https://example.com$request_uri;
}
server {
listen [::]:80;
listen 80;
[
// diable auto-pairing of single quotes
{ "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'$0'"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true },
{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "['a-zA-Z0-9_]$", "match_all": true },
{ "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single - punctuation.definition.string.end", "match_all": true }
]
@mgrahamjo
mgrahamjo / MJquery.js
Created August 7, 2015 17:11
Alternative to jQuery
var $ = function(selector) {
var els = [].slice.call(document.querySelectorAll(selector));
return els.length > 1 ? els : els[0];
};