Skip to content

Instantly share code, notes, and snippets.

slingin code

Phil upvalue

slingin code
View GitHub Profile
# 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):
# clone foo/bar => git clone
function clone; git clone --recursive$argv; end
upvalue / empty-gql.js
Created Jul 10, 2018
Empty gql tag to get VSCode IDE features without any library dependencies
View empty-gql.js
const gql = (strings: ReadonlyArray<string>) => {
return strings.join('');
View gist:99b5d6775a9e292f1df0de0920369eec
For future reference:
- Check proxy is set
- Check that deployment branch is set if not developing on master
- Check that letsencrypt is set
upvalue / index.tsx
Last active Jan 13, 2018
TypeScript + React + mobx-state-tree
View index.tsx
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 /
Last active Aug 21, 2017
Try a new CircleCI config without committing
#!/usr/bin/env bash
# -- Tries to run a new .circleci/config.yml from a checked out github repo without committing
# Usage: from the toplevel of a Git repo
# Requires $CIRCLECI_CLI_TOKEN to be set
# Thanks:
set -x
GITHUB_REPO_STR=`git config --get remote.origin.url`
upvalue / bootstrap.scss
Created Jul 31, 2017
strip unneeded bootstrap components
View bootstrap.scss
@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 / tslint.json
Created Jul 3, 2017
tslint.json that mostly follows tslint-config-airbnb; requires tslint-config-airbnb to be installed
View tslint.json
"defaultSeverity": "error",
"extends": [
"jsRules": {},
"rules": {
"align": [false],
"import-name": false,
"variable-name": false
upvalue / settings.json
Last active Jul 2, 2017
vscode settings
View settings.json
// 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],
upvalue /
Last active Jun 10, 2017
count comments as a percentage of LOC with cloc
#!/usr/bin/env python
# - using cloc, return percentage of code that is comments
# usage: cloccomment <arguments to be passed to cloc>
import sys
import subprocess
args = sys.argv[1:]
results = subprocess.check_output(['cloc'] + args).decode('utf-8')
You can’t perform that action at this time.