Skip to content

Instantly share code, notes, and snippets.

||news.ycombinator.com$document
@upvalue
upvalue / routed_cloud_function.py
Created January 20, 2019 01:37
Routing for GCF.
# hack together router with werkzeug because google cloud functions does not
# support full flask apps
from werkzeug.routing import Map, Rule, NotFound
from werkzeug.exceptions import MethodNotAllowed, HTTPException
url_map = []
def route(path, methods=("GET",)):
def decorator(fn):
# https://news.ycombinator.com/item?id=18214677
# clone foo/bar => git clone https://github.com/foo/bar
function clone; git clone --recursive https://github.com/$argv; end
@upvalue
upvalue / empty-gql.js
Created July 10, 2018 03:20
Empty gql tag to get VSCode IDE features without any library dependencies
const gql = (strings: ReadonlyArray<string>) => {
return strings.join('');
}
For future reference:
- Check proxy is set
- Check that deployment branch is set if not developing on master
- Check that letsencrypt is set
@upvalue
upvalue / index.tsx
Last active January 13, 2018 20:52
TypeScript + React + mobx-state-tree
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { computed, observable } from 'mobx';
import { observer } from 'mobx-react';
import { types } from 'mobx-state-tree';
const Todo = types.model({
@upvalue
upvalue / circleci-try.sh
Last active August 21, 2017 01:49
Try a new CircleCI config without committing
#!/usr/bin/env bash
# circleci-try.sh -- Tries to run a new .circleci/config.yml from a checked out github repo without committing
# Usage: circleci-try.sh from the toplevel of a Git repo
# Requires $CIRCLECI_CLI_TOKEN to be set
# Thanks: https://discuss.circleci.com/t/running-new-config-files-without-committing/11842
set -x
GITHUB_REPO_STR=`git config --get remote.origin.url`
RESULT=$?
@upvalue
upvalue / bootstrap.scss
Created July 31, 2017 09:02
strip unneeded bootstrap components
@import "~bootstrap/scss/variables";
@import "~bootstrap/scss/mixins";
@import "~bootstrap/scss/custom";
// Reset and dependencies
@import "~bootstrap/scss/normalize";
@import "~bootstrap/scss/print";
// Core CSS
@import "~bootstrap/scss/reboot";
@upvalue
upvalue / tslint.json
Created July 3, 2017 01:52
tslint.json that mostly follows tslint-config-airbnb; requires tslint-config-airbnb to be installed
{
"defaultSeverity": "error",
"extends": [
"tslint-config-airbnb"
],
"jsRules": {},
"rules": {
"align": [false],
"import-name": false,
"variable-name": false
@upvalue
upvalue / settings.json
Last active July 2, 2017 03:19
vscode settings
// settings.json - VSCode settings
{
"editor.fontSize": 12,
"editor.lineNumbers": "relative",
"workbench.colorTheme": "Zenburn",
"window.menuBarVisibility": "toggle",
"typescript.check.tscVersion": false,
"editor.tabSize": 2,
"editor.renderWhitespace": "boundary",
"editor.rulers": [100],