Skip to content

Instantly share code, notes, and snippets.

@xavriley
xavriley / dont_drop_the_bass.rb
Created July 8, 2017 20:38
Don't Drop the Bass - Source code with comments - Brighton Ruby 2017
# ❤️ Brighton Ruby
# This code uses some features from the pre-release of Sonic Pi,
# due out later this month (touch wood!).
# If you just can't wait for the release but want to try it yourself
# you can either build the Sonic Pi master branch from source (pros: free, cons: hard)
# or share some love and contribute to the Patreon page to support Sonic Pi's development
# https://www.patreon.com/samaaron
# That will give to access to the latest pre-release versions
@xavriley
xavriley / live_sample.rb
Created July 8, 2017 20:20
live_sample definition for Sonic Pi v2.13 and above
# place in ~/.sonic-pi/init.rb to autoload
def live_sample(name=nil, *args)
raise ArgumentError, "live_sample needs to have a unique name. For example: live_sample :foo" unless name
raise ArgumentError, "live_sample's name needs to be a string or symbol, got: #{name.inspect}. Example usage: live_sample :foo" unless (name.is_a?(Symbol) || name.is_a?(String))
ls_name = "live_sample_#{name}".to_sym
args_h = resolve_synth_opts_hash_or_array(args)
click = args_h[:click] || 4
dur = args_h[:dur]
@swarminglogic
swarminglogic / watchfile.sh
Last active March 4, 2024 14:44
watchfile - monitor file(s) and execute a command when files are changed
#!/bin/bash
version=1.0.1
versionDate="2014-02-14"
function showHelp() {
echo "watchfile - monitor file(s)/command and perform action when changed
Possible ways of usage
----------------------------------------