View carbon.sh.sublime-project.json
{
...,
"build_systems":
[
{
...,
"variants":
[
...,
{
View carbonify.js
#!/usr/bin/env node
/*
Submit code from stdin to carbon.now.sh and return a url to a new tweet containing a screenshot
carbon.now.sh authors: https://dawnlabs.io/
carbonify author: Nick Sweeting <git@nicksweeting.com>
MIT License 2017
*/
View event_listeners.js
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')
View optional_args_decorator.py
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__)
View immutify.js
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
}
View monadical-protonmail-theme.css
.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
View fork
#!/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
View dump_pocket.py
#!/usr/bin/env python3
# Nick Sweeting 2017 | MIT License
# Usage:
# 1. Download pocket export from https://getpocket.com/export to ril_export.html
# 2. Run ./dump_pocket.py ril_export.html
# 4. Archive is saved in "pocket" folder
# Dependencies (chrome, python3, wget):
# wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
View double_fork.py
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:
View autocast.py
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):