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
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
<<<<<<< HEAD
}
=======
}
>>>>>>> origin/branchname
@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'
@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
#!/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 / gist:4933
Created August 11, 2008 20:19 — forked from mmower/gist:4932
def note_to_freq( note_num )
base_note_num = note_num - 69
440.0 * Math.exp( 0.057762265 * ( note_num - 69 ) )
end
60.upto(72) {|n| puts note_to_freq(n) / note_to_freq(60) }
1.0
1.05946309430986 # 61, C#
1.12246204820462 # 62, D
1.18920711483625 # 63, D#
@mattly
mattly / profile.rb
Created October 20, 2008 06:52
profile of max<>ruby vs pure ruby scheduling
require 'rubygems'
require 'datagrammer'
require 'statarray'
deltas = StatArray.new
ticks = StatArray.new
d = Datagrammer.new(5000)
last = Time.now.to_f
last_tick = 0
d.listen do |slf, msg|
# = rCouch (working title)
# a system for working with couchdb documents that works similar to jquery
Collection.new(@db, {})
Collection.new(@db, [{}, {}])
# creates a collection of documents
# == Retrieving from the Database
# Single Document GET, for when you know the id
Autosaver = function(formele, options) {
var form = $(formele);
var settings = $.extend({
checkDirtyTime: 2000,
saveTime: 15000,
statusEle: '.save-status',
serialize: function(observing) {
var elements = $('[name=]', form);
if (observing) { elements = elements.not('[name=_rev],[name=_id]'); }
return elements.serialize();
# todo: add handlers for erb blocks
# example:
# - content_for :head do
# :javascript
# var foo = "foobar"
# and then in where you want that:
# = content_for :head
def content_for bin, content=nil, &block