Skip to content

Instantly share code, notes, and snippets.

View upvalue's full-sized avatar
🐴

Phil upvalue

🐴
View GitHub Profile
@upvalue
upvalue / PLAN.org
Last active July 1, 2017 23:47
Nice looking org exported HTML with sakura.css

Title

@upvalue
upvalue / immutable-2d-array.js
Last active June 2, 2017 21:54
JavaScript immutable two-dimensional array of arrays
class ArrayView {
constructor(array, x, y, width, height) {
this.array = array;
this.x = x;
this.y = y;
// Automatic bounding
// x = 30, width of backing array = 50, width of this = 30
// width = 50 - 30 = 20
let max_width = array.width - x;
@upvalue
upvalue / index.d.ts
Created June 8, 2017 22:53
not-yet-functional react-treebeard bindings for typescript
// TypeScript bindings for react-sortable-tree
declare module "react-treebeard" {
import * as React from 'react';
export interface Node {
id?: string;
name: string;
active?: boolean;
toggled?: boolean;
@upvalue
upvalue / cloccomment.py
Last active June 10, 2017 04:52
count comments as a percentage of LOC with cloc
#!/usr/bin/env python
# cloccomment.py - 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')
@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],
@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 / 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 / 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 / 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({
For future reference:
- Check proxy is set
- Check that deployment branch is set if not developing on master
- Check that letsencrypt is set