Skip to content

Instantly share code, notes, and snippets.


Tony Crowe tcrowe

View GitHub Profile
tcrowe / polka-express-http-proxy.js
Created Aug 23, 2019
polka sapper api proxy example
View polka-express-http-proxy.js
they usually use ES Modules but i used CommonJS here
you can port it to suite your need
const sirv = require("sirv");
const polka = require("polka");
const compression = require("compression");
tcrowe / install-and-configure-mumble-server.zsh
Last active Apr 26, 2020
install and configure mumble server - set variables, run it, talk 👍
View install-and-configure-mumble-server.zsh
ssh my-server << EOF
# install
apt install -y mumble-server
tcrowe / binary-command-exists.zsh
Created Jun 2, 2019
Bash or ZSH: Check if a binary or command exists
View binary-command-exists.zsh
# which goes into dev null
# $? is the magic that tells us if it worked 0 = exists
if [[ `which nvm &>/dev/null && $?` != 0 ]]; then
source ~/.nvm/
tcrowe / npm-auth-token.js
Last active Feb 2, 2020
npm auth token with zsh or bash and curl or node
View npm-auth-token.js
// npm install superagent
const superagent = require("superagent");
// this is verdaccio's url ↓ but you could use like if that is allowed in their TOS
const registryUrl = "";
const username = "myusername2";
const password = "mypassword2";
const frm ={
name: username,
tcrowe / object-ification-of-promise.js
Created Feb 1, 2020
Turn async await promise into object result
View object-ification-of-promise.js
* Object-ification of a promise result
* @method to
* @param {promise} p
* @returns {array}
const to = p =>
p.then(res => ({ err: null, res }))
.catch(err => ({ err }));
tcrowe / tuple-ification-of-promise.js
Created Feb 1, 2020
Turn async await into tuple output
View tuple-ification-of-promise.js
* Tuple-ification of a promise result
* @method to
* @param {promise} p
* @returns {array}
const to = p => p.then(res => [null, res]).catch(err => [err]);
tcrowe /
Created Sep 24, 2019
Reminer about clickable SVG path

A pal discovered a trick with SVG paths. It was not clickable by default!

He found that you must customize it with CSS:

figured it out, for future reference you need to set 
the "pointer-events" property on a path to make it
clickable. There are various options available.

Found a handy little reference here... 
tcrowe / sapper-preload-example.svelte
Created Sep 25, 2019
Sapper preload instead of using stores for dynamic data
View sapper-preload-example.svelte
<script context="module">
Preload runs on the client AND server
export async function preload({ path, query, params, session }) {
console.log('path', path)
console.log('query', query)
console.log('params', params)
tcrowe / keymap.cson
Created Oct 25, 2019
atom editor, emmet, svelte language-specific tab trigger, keymap.cson
View keymap.cson
# svelte language-specific tab trigger
# NOT source.js scope -------------------------------v
'atom-text-editor[data-grammar="source svelte"]:not(.source.js)':
'tab': 'emmet:expand-abbreviation-with-tab'
tcrowe / oblierate-service.zsh
Created Jan 29, 2020
Obliterate systemd service
View oblierate-service.zsh
# Obliterate systemd service
systemctl stop $1 2>/dev/null || true
systemctl stop $1.service 2>/dev/null || true
systemctl disable $1 2>/dev/null || true
You can’t perform that action at this time.