This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cached_property(func): | |
property_name = '_' + func.__name__ | |
@functools.wraps(func) | |
def wrapped(self, *args, **kwargs): | |
private_property = getattr(self, property_name, None) | |
if kwargs.get('force', False) or private_property == None: | |
val = func(self, *args, **kwargs) | |
setattr(self, property_name, val) | |
return val | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
if [ "$CURRENT_BRANCH" != "jekyll" ]; then | |
echo "ERROR! You can only deploy from jekyll branch" | |
exit 1 | |
fi | |
CLEAN_REPO=$(git status --porcelain) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# This is a basic script to launch multiple programs and kill them | |
# all at the same time. It does this by launching the first n-1 jobs as | |
# background jobs, then running the nth job as a foreground job. | |
# | |
# It traps the exist signal produced by doing `CTRL-C` on the CLI and | |
# iterates through the PIDs of the background jobs and runs kill -9 on them. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
usage() { | |
cat >&2 << EOF | |
killport: kill -9 any process that is bound to a local port | |
Usage: | |
killport <port> | |
EOF | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Google VIM Hotkeys | |
// @namespace https://gist.github.com/ccjmne | |
// @version 0.0.1 | |
// @description Navigate results from Google using j/k vim bindings | |
// @author Thomas Millar <[email protected]> (https://github.com/thmsmlr) | |
// @match *://www.google.com/* | |
// @grant none | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
child_spec = Task.child_spec(fn -> | |
IO.puts(""" | |
I am doing daemon things for my Livebook. | |
If I re-evaluate the cell, this task will be terminated and restart with the new version of the code. | |
If the task ever terminates, the Supervisor will automatically restart it. | |
Useful for running things in the background that don't need to directly interact with your notebook. | |
""") | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// assets/js/app.js | |
window._lazy_hooks = window._lazy_hooks || {}; | |
let lazyHook = function(hook) { | |
return { | |
mounted() { window._lazy_hooks[hook].mounted(...arguments) }, | |
beforeUpdate() { window._lazy_hooks[hook].beforeUpdate(...arguments) }, | |
updated() { window._lazy_hooks[hook].updated(...arguments) }, | |
destroyed() { window._lazy_hooks[hook].destroyed(...arguments) }, | |
disconnected() { window._lazy_hooks[hook].disconnected(...arguments) }, |