Skip to content

Instantly share code, notes, and snippets.

View mattly's full-sized avatar
💭
I may be slow to respond.

Matthew Lyon mattly

💭
I may be slow to respond.
View GitHub Profile
#!/usr/bin/env bash
getDir () {
fname=$1
[ -h $fname ] && fname=$(readlink $fname)
echo "$(cd "$(dirname $fname)" && pwd)"
}
# used by loader to find core/ and stdlib/
BORK_SOURCE_DIR="$(getDir $(getDir ${BASH_SOURCE[0]}))"
BORK_SCRIPT_DIR=$PWD
BORK_WORKING_DIR=$PWD
@mattly
mattly / fedtaxes.calca
Last active August 29, 2015 14:22
Federal Tax in Calca
brackets = [ 13,150, 50,200, 129,601, 209,851, 411,501, 439,000, 999,999,999,999]
rates = [ 10%, 15%, 25%, 28%, 33%, 35%, 39.6%]
tax (amt, level) =
let this = brackets[level] in
let prev = brackets[level-1] in
let rate = rates[level] in
if this <= amt then (this - prev) * rate
else if prev < amt then (amt - prev) * rate
else 0
@mattly
mattly / tweettrim.rb
Last active March 21, 2016 19:37 — forked from robinsloan/langoliers.rb
Rolling Tweet Deletion
#!/usr/bin/env ruby
require 'rubygems'
require 'twitter'
require 'json'
require 'faraday'
# things you must configure
TWITTER_USER = "you"
# get these from dev.twitter.com
@mattly
mattly / tweetnuke.rb
Last active August 29, 2015 14:16 — forked from robinsloan/langoliers.rb
nuke your twitter history
#!/usr/bin/env ruby
# Modified from https://gist.github.com/robinsloan/3688616
# This version will nuke your entire twitter history past a certain threshold.
# It requires you to download your archive from twitter and put "tweets.csv"
# in the same directory as this script.
require 'rubygems'
require 'twitter'
require 'json'
require 'faraday'
require 'csv'
<<<<<<< HEAD
}
=======
}
>>>>>>> origin/branchname
mattly@lluvia:~/c/w/projectname :) make all
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
mattly@lluvia:~/c/w/projectname :E69
@mattly
mattly / nodeleaders.markdown
Created March 26, 2014 18:53
best of nodeleaders

If asked why your module isn't using Streams 2, well it makes it so much harder to use a stream as an iterative work queue. Sound SMART.

Node's error handling was inspired by getting mugged in Oakland: You're gonna die and you better have someone to resurrect you.

Our weaponized crime-fighting #nodebotsday project just up and left. “Excuse me, I have to go. Somewhere there is a crime happening” it said

Rewrite all your apps in asm.js for both performance and clarity. It’s even closer to the metal.

@mattly
mattly / house.md
Last active December 20, 2015 07:48

House Shopping

rate(term, amount) =
    let n = term * 12/year in
    let r = ir / (12/year) in
    r/(1 - (1+r)^(-n)) * amount
    
house at(house) =
    let fifteen = rate(15year, house - down payment) in

let thirty = rate(30year, house - down payment) in

@mattly
mattly / gist:5555614
Last active December 17, 2015 05:09
Crock Pot Kalua Pork

Ingredients

  • 4lbs Pork Shoulder
  • 1tbsp Liquid Smoke
  • 2-3tbsp Hawaiian Red Sea Salt
  • 1 Banana Leaf

Process

  1. Tenderize the pork with a fork. Get lots of holes to help prevent it from drying out. The thicker your cut of meat is, the more frequent the holes should be.
# "affix" and "scrollspy", before bootstrap had them:
$ ->
$nav = $('nav')
navTop = $nav.offset?().top - 12
navFixed = 0
sections = {}
for section in $('section')
$section = $(section)
id = $section.attr('id')
if id