Skip to content

Instantly share code, notes, and snippets.

View andycroll's full-sized avatar

Andy Croll andycroll

View GitHub Profile
@andycroll
andycroll / sonic-pi-fiddlings.rb
Created February 16, 2017 21:40
Potential Pod Sounds
# Intro
with_fx :reverb, mix: 0.2 do
16.times do
play scale(:Eb2, :blues_major, num_octaves: 3).choose, release: 0.1, amp: rand
sleep 0.1
end
end
sleep 1
@andycroll
andycroll / bottles.rb
Created August 30, 2016 14:12
My solution to 99bottles exercise
class Bottles
def song
verses(99, 0)
end
def verse(n)
<<~HEREDOC
#{bottle_count(n).capitalize} on the wall, #{bottle_count(n)}.
#{action(n)}, #{bottle_count(n-1)} on the wall.
HEREDOC
Andy Croll: Organiser of Brighton Ruby, Designer & Rails Developer, parent of twins, mostly knackered.
Kinsey Ann Durham: From Denver, engineer at GoSpotCheck, big part of Kubmo and BridgeFoundry, RubyJAM veteran
Aaron Patterson: developer at RedHat, member of both the Ruby and Rails core teams, founder of the Friday Hug
Sam Phippen: UK, Ruby Developer at FunAndPlausible and member of the RSpec core team, RubyJAM veteran
@andycroll
andycroll / Preferences.sublime-settings
Created May 18, 2013 21:20
My preferences for Sublime Text 3
{
"bold_folder_labels": true,
"caret_style": "wide",
"color_scheme": "Packages/Theme - Phoenix/Color Scheme/Tomorrow-Night.tmTheme",
"ensure_newline_at_eof_on_save": true,
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
require 'redgreen/autotest'
require 'autotest/growl'
require 'autotest/fsevent' #osx specific file changed event notification
Autotest::Growl::show_modified_files = true #which changes prompted the autospec run
Autotest::Growl::remote_notification = true #networked growl, to work-around disappearing notifications
Autotest.add_hook :initialize do |at|
%w{.git .svn .hg .DS_Store ._* log}.each {|exception|at.add_exception(exception)}
end
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
@andycroll
andycroll / bashrc
Created April 15, 2010 15:27
bash_profile
export PATH=/usr/local/bin:$PATH
export PATH="$HOME/.rbenv/bin:$PATH"
# Git Prompt - http://github.com/blog/297-dirty-git-state-in-your-prompt
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
require 'benchmark'
require 'pp'
def build_fixtures(n_teams, play_each_other=1)
teams = (1..n_teams).to_a
n_rounds = n_teams - 1 + n_teams%2
fixtures_per_round = n_teams / 2
# puts "Teams : #{teams.inspect}"
# puts "Rounds : #{n_rounds}"
# puts "Games per : #{fixtures_per_round}"