Skip to content

Instantly share code, notes, and snippets.

💭
💻 🎨 🎵

Joseph Wilk josephwilk

💭
💻 🎨 🎵
Block or report user

Report or block josephwilk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:3684a3ccac715c54ebaf
define :degrees do |degree,scale,root|
the_degrees = {:i => 1, :ii => 2, :iii => 3,
:iv => 4, :v => 5, :vi => 6,
:vii => 7, :_ => nil}
intervals = Scale::SCALE[scale]
intervals = intervals.cycle.take(the_degrees[degree]-1)
note(root) + intervals.reduce(0,:+)
end
View gist:77c07f45c588e3e0ba68
require 'rubygems'
$LOAD_PATH.unshift '/Users/josephwilk/Workspace/ruby/ashton/lib/'
require "ashton"
class TestWindow < Gosu::Window
NOISE_FRAGMENT =<<-END
#version 110
// Use 3D Simplex noise, even though the shader operates on a 2D
// texture, since then we can make the Z-coordinate act as time.
View retune-dnb.rb
# Live coding example for Retune conference 2014
# 1) Press Run (Cmd+R) to start
# 2) Make changes (e.g. comment in/out various lines in :beats & :amen)
# 3) Press Run again (changes will only be audible from next queue point)
# compute loop length (4 bars), bar & quarter note durations
dur = sample_duration :loop_compus
bar = dur / 4
quart = dur / 16
View gist:dceacbfade02c8901973
puts "adasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasd"
puts "adasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasdadasd
View gist:c6c9ab68e65810a0844f
live_loop :timer do
sleep 1
sleep 1
end
live_loop :drummer do
sync :timer
play degree(1, :A2, :major)
sleep 2
end
View zone_finder.rb
require 'open-uri'
require 'fastercsv'
class ZoneFinder
# Creates a ZoneFinder object
def initialize(network_data_path)
@network_data_path = network_data_path
end
View gist:7936
module ValidationTestHelper
def assert_valid(field, *values)
__model_check__
values.flatten.each do |value|
o = __setup_model__(field, value)
if o.valid?
assert_block { true }
else
messages = [o.errors[field]].flatten
assert_block("unexpected invalid field <#{o.class}##{field}>, value: <#{value.inspect}>, errors: <#{o.errors[field].inspect}>.") { false }
View gist:21931
Feature: Compile C code into Ruby extensions.
In order to automate compilation process.
As a Gem developer.
I want rake tasks compile source code for me.
Scenario: Compile single extension
Given a safe project directory
And scaffold code for extension 'extension_one'
And 'tmp' folder is deleted
View bag_of_matcher.rb
require 'set'
module BagOfMatchers
class Bag
def initialize(list)
@list = Set.new(list)
end
def matches?(list)
View gist:27481
default: rails
rails: --require step_definitions/common --require step_definitions/rails rails/
browser: --require step_definitions/common --require step_definitions/selenium browser/
You can’t perform that action at this time.