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
{% extends "ui/base.html" %} | |
{% block title %}{{title}}{% endblock %} | |
{% block inner %} | |
<div id="react"> | |
<!-- Contents get replaced by mounted React.Component --> | |
<i class="fa fa-lg fa-spinner fa-spin"></i><br><br> | |
<i class="pending">Loading components...</i><br><br> | |
</div> |
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 autocast(func): | |
"""Tries to cast any parameters with type hints to the type defined. | |
Will not act if more than one type is defined. | |
Try to avoid using this, instead type-cast within your function to the desired types.""" | |
def autocast_wrapper(*args, **kwargs): | |
sig = signature(func) | |
def convert(arg, param): |
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
import os | |
import sys | |
def DOUBLE_FORK(): | |
"""Perform a UNIX double-fork to detach, and re attach process to init so it's not a child of web worker""" | |
# do the UNIX double-fork magic, see Stevens' "Advanced | |
# Programming in the UNIX Environment" for details (ISBN 0201563177) | |
try: | |
pid = os.fork() | |
if pid > 0: |
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/bash | |
/usr/local/bin/fish -c "$*" > ~/tmp/fish_forks/last.log 2>&1 & | |
pid=$! | |
mv ~/tmp/fish_forks/last.log ~/tmp/fish_forks/$pid.log | |
disown $pid |
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
.headerDesktop-container{background-color:#0d0d0d}.search-form-fieldset{background:#000}[class*="searchForm-action-button-"]{color:#fff}.searchForm-action-button-advanced:hover,.searchForm-action-button-toggle:hover{background:orange}.customRadio-input:checked+.customRadio-mask{box-shadow:inset 0 0 0 3px #fff,inset 0 0 0 10px orange;border-color:orange}.pm_button.primary,.pm_button.primary:active{color:#fff;background-color:#0d0d0d;border-color:#0d0d0d}.pm_button.primary:hover,.pm_button.primary:focus{background-color:#000;border-color:#000}.navigation>li.active,.navigation>li:hover{box-shadow:0 5px 0 0 orange inset}.navigation-link{color:#fff}.navigation-title:hover{color:orange}.pm_dropdown .navigationUser-logout{background-color:#0d0d0d !important;border-color:#0d0d0d !important;color:#fff !important}.pm_dropdown .navigationUser-logout:hover{background-color:#000 !important;border-color:#000 !important;color:#fff !important}.sidebar-btn-compose,.sidebar-btn-compose:active{color:#fff !important;background:o |
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 optional_arg_decorator(fn): | |
""" | |
wrap a decorator so that it can optionally take args/kwargs | |
when decorating a func | |
""" | |
# http://stackoverflow.com/a/32292739/2156113 | |
@wraps(fn) | |
def wrapped_decorator(*args, **kwargs): | |
is_bound_method = args and hasattr(args[0], fn.__name__) |
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
const immutify = (obj) => { | |
const obj = Object.keys(obj).reduce((acc, key) => { | |
Object.defineProperty(acc, key, { value: obj[key], writable: false, enumerable: true}) | |
return acc | |
}, {}) | |
const hash = hashObj(obj) | |
Object.defineProperty(obj, 'hash', { value: hash, writable: false, enumerable: false}) | |
Object.preventExtensions(obj) | |
return obj | |
} |
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
import {desktopNotify, requestDesktopNotify} from '@/util/browser' | |
// when user clicks "notify me" checkbox | |
requestDesktopNotify() | |
store.dispatch({ | |
type: 'ADD_EVENT_LISTENER', | |
pattern: 'ALERT', | |
handler: (action) => { | |
if (action.alert.subtype == 'sit_in') |
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
{ | |
..., | |
"build_systems": | |
[ | |
{ | |
..., | |
"variants": | |
[ | |
..., | |
{ |
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
""" | |
Take a bookmark archiver folder structure and turn it into a deduped | |
merkel-tree blob index. | |
For example: | |
archive = { | |
'https://google.com': { | |
'index.html': 125, # arbitrary bytes as file content | |
'js': { |