Skip to content

Instantly share code, notes, and snippets.

@rgruesbeck
rgruesbeck / tmuxhelper.txt
Last active December 21, 2017 22:09
tmux helper function that works well with teamocil
mux () {
# tmux helper function
templates="/home/ron/.teamocil/"
if [ -z $1 ]
then
echo "Sessions:"
tmux ls
echo ""
echo "Templates:"
ls $templates
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
apt-cache policy docker-ce
sudo apt-get install -y docker-ce
sudo systemctl status docker
addusertogroup
@rgruesbeck
rgruesbeck / random.sh
Last active November 13, 2018 00:53
get random strings from your mic
#!/usr/bin/env bash
clip() {
# sync clipboards
xclip -o | xclip -sel clip
# print to stdout
xclip -o
}
@rgruesbeck
rgruesbeck / coldaddress.sh
Last active November 15, 2018 02:51
create an offline address by coin toss: requires https://github.com/libbitcoin/libbitcoin-explorer
#!/usr/bin/env bash
length=256
bits=()
prvk=""
pubk=""
mnemonic=""
# collect coin flips
function getBits() {
@rgruesbeck
rgruesbeck / gist:174d29f244494ead21e2621f6f0d79ee
Last active April 12, 2019 20:46
koji live preview injection
// listen for post message
// you will need to attach the listener to window instead of document for this to work
window.addEventListener("message", injectHandler, false);
// handle the update
function injectHandler({ data }) {
if (data.action === 'injectGlobal') {
let { scope, key, value } = data.payload;
config[scope][key] = value;
@rgruesbeck
rgruesbeck / index.js
Created April 24, 2019 06:47
functional sprite: composed move function
const withConstructor = constructor => o => ({
__proto__: { constructor },
...o
});
const mix = (...fns) => x => fns.reduce((y, f) => f(y), x);
const canMove = o => {
return {
...o,
window.postMessage({ action: 'injectGlobal', payload: { scope: 'general', key: 'startText', value: 'startx' }}, "*")
{
"deploy": {
"subdomain": "testphaser.withkoji.com",
"frontend": {
"output": "dist",
"commands": [
"npm install",
"export NODE_ENV=production && npm run build"
]
}
// https://dzone.com/articles/300-ms-click-delay-and-ios-8
// https://patrickhlauke.github.io/touch/tests/results/
// https://developer.mozilla.org/en-US/docs/Web/API/Performance/measure
<button>Click</button>
<p style="color: black;">Delay was <span></span> milliseconds.</p>
<script>
var button = document.querySelector("button"),
span = document.querySelector("span"),
delay;
overview: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Optimizing_canvas
garbage collection: http://buildnewgames.com/garbage-collector-friendly-code/
bitwise optimizations: https://galactic.ink/journal/2011/11/bitwise-gems-and-other-optimizations/
perf: https://developers.google.com/web/tools/chrome-devtools/rendering-tools/