Skip to content

Instantly share code, notes, and snippets.

View TSFoster's full-sized avatar

Toby Foster TSFoster

View GitHub Profile
@TSFoster
TSFoster / tax
Created July 2, 2013 14:38
Tiny command line utility that lets you work out values for tax or before- or after-tax earnings. `tax earnings_from x` lets you know your after-tax earnings from your before-tax earnings. `tax tax_on x` lets you know how much you'll be taxed from your before-tax earnings. `tax to_earn x` lets you know how much you'll have to earn to end up with…
#!/usr/bin/env ruby
# encoding: utf-8
class TaxCalculator
INFINITY = 1.0/0.0
DEFAULT_RATES = {
0.0...9440.0 => 0.0 ,
9440.0...32010.0 => 0.2 ,
32010.0...150000.0 => 0.4 ,
150000.0..INFINITY => 0.45
class BatchItemProcessor
attr_accessor :processed_items
def initialize
reset
end
def process_items items
items.each do |item|
identifier=@identifier.call(item)
@TSFoster
TSFoster / .cvimrc
Last active March 9, 2017 01:08
cVimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Settings
" --------
set noautofocus
set cncpcompletion
set linkanimations
set dimhintcharacters
set typelinkhints
set smartcase
let hintcharacters = "asdfjkl"
@TSFoster
TSFoster / cVim.css
Last active January 3, 2018 17:28
cVim CSS
#cVim-link-container, .cVim-link-hint, #cVim-command-bar, #cVim-command-bar-mode, #cVim-command-bar-input, #cVim-command-bar-search-results, .cVim-completion-item, .cVim-completion-item .cVim-full, .cVim-completion-item .cVim-left, .cVim-completion-item .cVim-right, #cVim-hud, #cVim-status-bar {
font-family: "Triplicate T4p";
font-size: 17px !important;
-webkit-font-smoothing: antialiased !important;
}
#cVim-link-container {
position: absolute;
pointer-events: none;
@TSFoster
TSFoster / sVim.css
Last active October 13, 2017 09:17
sVim.css
@-webkit-keyframes fadein {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
#sVim-command {
@TSFoster
TSFoster / .sVimrc
Last active October 10, 2018 10:36
.sVimrc
let scrollstep = 100
let hintcharacters = "asdfjkl"
let homeurl = "about:blank"
let mapleader = "space"
let blacklists = ["*://www.fastmail.com/*","*://mail.google.com/*","*://docs.google.com/*","*://*feedbin.com/*","*://www.babbel.com/*","*://*trello.com/*","*://www.codewars.com/*","*://www.shortcutfoo.com/*","*://getpocket.com/*","*://*netflix.com/*","*://app.youneedabudget.com/*", "*://codepen.io/*","*://duckduckgo.com/*","*://www.youtube.com/watch?*","https://ellie-app.com/*"]
@TSFoster
TSFoster / script.js
Created March 22, 2018 01:15
Open files in existing neovim instance in iTerm
/*
Requirements:
* iTerm
* nvim
* nvr
Install:
1. New application in Automator
2. Add Run JavaScript action
@TSFoster
TSFoster / pre-commit
Last active November 15, 2019 11:28
pre-commit hook for elm packages with a package.json
#!/bin/sh
ELM_JSON_VERSION="$(jq -r .version elm.json)"
PACKAGE_JSON_VERSION="$(jq -r .version package.json)"
if [ $ELM_JSON_VERSION != $PACKAGE_JSON_VERSION ]; then
echo "Version in elm.json ($ELM_JSON_VERSION) does not match version in package.json ($PACKAGE_JSON_VERSION)"
if [ -n "$(git status --porcelain package.json)" ]; then
echo "Cannot fix package.json as it contains unstaged changes" >&2
exit 1

Keybase proof

I hereby claim:

  • I am tsfoster on github.
  • I am tsfoster (https://keybase.io/tsfoster) on keybase.
  • I have a public key ASDicVgV0WCLbyqBXWbtPa_u_LAZ5l6zL6PahTKBacEjogo

To claim this, I am signing this object: