This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# = 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Time | |
# because i often times have trouble keeping these straight | |
# >> 1.day.ago.before? Time.now | |
# => true | |
# >> 1.day.from_now.before? Time.now | |
# => false | |
# >> 1.day.from_now.after? Time.now | |
# => true | |
# >> 1.day.ago.after? Time.now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mattly@Selene ~clients/[redacted]/[redacted] git:master > rake spec | |
(in /Users/mattly/clients/[redacted]/[redacted]) | |
spec/spec_helper.rb:12 | |
require 'rspec_on_rails_on_crack' | |
(rdb:1) p Spec::VERSION::SUMMARY | |
"rspec 1.2.4" | |
# FAIL! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module TaskList | |
def self.included(base) | |
base.extend Events | |
base.send :include, Events | |
end | |
module Events | |
def events | |
@events ||= Hash.new {|h,k| h[k] = []} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Site | |
include Exegesis::Database | |
design :pages do | |
docs :by_state | |
docs :for_path | |
def at_path(path='') | |
for_path([path, ''..'ZZZZ'])[path] | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe MyApp do | |
include Sinatra::Test | |
before do | |
@app = MyApp | |
setup_site | |
setup_user | |
end | |
describe "when logged in" do |
OlderNewer