Skip to content

Instantly share code, notes, and snippets.

View natebunnyfield's full-sized avatar

Nate Bunnyfield natebunnyfield

View GitHub Profile
#!/bin/sh
function strip_tags {
sed "s/<[^>][^>]*>//g; s/^ *//g"
}
function break_every_third_line {
awk '{ if ( NR % 3 == 0 || NR == 1 ) print "" } { print }'
}
function sentencecase {
gsed "s/\([^.]\s\)\([A-Z]\)/\1\l\2/g"
}
#!/usr/bin/ruby
require 'optparse'
require 'appscript'
require 'growl'
include Appscript
include Growl
class Pomodoro
attr_accessor :playlist, :time, :message, :lock, :done
@natebunnyfield
natebunnyfield / cache.js
Created July 30, 2010 05:28
homework from javascriptmasterclass.com; paired with http://github.com/chrisdickinson
var Cache = function() {
this.table = {};
};
Cache.prototype = {
'get': function(key) {
return this.table[key];
},
'set': function(key, value) {
return this.table[key] = value;
// 1
document.getElementById('the_div').addEventListener(
'click', function(){ log('the_div!') }, true);
document.getElementById('the_list').addEventListener(
'click', function(){ log('the_list!') }, false);
document.getElementById('the_item').addEventListener(
'click', function(){ log('the_item!') }, true);
require 'osc-ruby'
@touchosc = OSC::Server.new(3818)
@ardour = OSC::Client.new('localhost', 3819)
@touchosc.add_method(/\/ardour/) do |m|
puts "#{m.address} #{m.to_a}"
if m.address == '/ardour/transport_play' and m.to_a == [0.0]
@ardour.send(OSC::Message.new('/ardour/transport_stop'))
@natebunnyfield
natebunnyfield / sky
Created May 14, 2012 04:11
weather to unicode
#!/bin/sh
([ $(date +%k) -lt 7 ] || [ $(date +%k) -gt 19 ]) && co=⚪ || co=☀
symbolize=" sed \
-e 's/ inch.*igher.*/↑/i' \
-e 's/ \(inch\|hPa\).*ower.*/↓/i' \
-e 's/overcast/☁☁/i' \
-e 's/partly cloudy/$co☁/i' \
-e 's/mostly cloudy/☁$co/i' \
-e 's/mostly sunny/☀☁/i' \
-e 's/partly sunny/☁☀/i' \
// ==UserScript==
// @name Octigones
// @namespace https://github.com
// @include https://github.com/*
// @description A GitHub beautifier.
// ==/UserScript==
var JQUERY_URL = 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js',
$;