Skip to content

Instantly share code, notes, and snippets.

def escape(text)
text.gsub('"', '\"')
end
search_term = escape(ARGV[0])
replace_term = escape(ARGV[1])
piped_input = STDIN.entries
piped_input.each do |line|
@JiggyPete
JiggyPete / bottles.rb
Created March 25, 2019 12:49
First exercise of the 99 Bottles of Milk book
class Bottles
def song
verses(99, 0)
end
def verses(start_index, end_index)
numbers_of_bottles = (end_index..start_index).to_a.reverse
all_verses = numbers_of_bottles.map{|number_of_bottles| verse(number_of_bottles)}
all_verses.join("\n")
end
@JiggyPete
JiggyPete / mario midi controls
Last active January 11, 2017 21:17
mario midi controls
// 1: Visit http://mario5.florian-rappl.de/#menu
// 2: Copy and paste the following code into the console
// 3: You may need to update the pad id's for your midi controller. Output will appear in the console when you press pads, take the 2nd value from each pad event and tweak the controller values at the bottom of this script, then paste it into the console again.
// request MIDI access
if (navigator.requestMIDIAccess) {
navigator.requestMIDIAccess({
sysex: false // this defaults to 'false' and we won't be covering sysex in this article.
}).then(onMIDISuccess, onMIDIFailure);
} else {
Day 1
1 Voicedude - Backstreet Uprising
http://www.bootiemashup.com/bestofbootie2014/Best%20of%20Bootie%202014%20-%20Bonus%20Tracks/Voicedude%20-%20Backstreet%20Uprising.mp3
2 SIR - Firework On The Dock Of The Bay K PerryO Redding
http://www.mashstix.com/004509
3 MadMixMustang - Get Lucky Star
http://www.bootiemashup.com/bestofbootie2013/Best%20of%20Bootie%202013%20-%20Bonus%20Tracks/MadMixMustang%20-%20Get%20Lucky%20Star.mp3
1 Divide & Kreate - Illiterate City: 2:07
http://www.soop.ca/bootie/bestofbootie2007/20%20-%20Divide%20&%20Kreate%20-%20Illiterate%20City.mp3
2 DJ Mario Santiago - Lilly Wood And The Prick (Robin Schulz Remix) vs. Red Hot Chili Peppers - Prayer In C vs. Otherside: 3:49
http://bootiemashup.com/bestofbootie2015/Best%20of%20Bootie%202015%20-%20Bonus%20Tracks/DJ%20Mario%20Santiago%20-%20Lilly%20Wood%20And%20The%20Prick%20(Robin%20Schulz%20Remix)%20vs.%20Red%20Hot%20Chili%20Peppers%20-%20Prayer%20In%20C%20vs.%20Otherside.mp3
3 DRAman - I Know How You Got Soul Eric B Rakim vs The Heavy
http://www.mashstix.com/004557
4 DJ Poulpi - No One Knows When The Sky Falls
# Prerequisit: ImageMagick installed
def file_exists?(filename)
`[ -f #{filename} ] && echo "Found" || echo "Not found"` == "Not found\n"
end
['landing'].each do |screengrab_file_name|
before = screengrab_file_name + '_before.png'
after = screengrab_file_name + '_after.png'
difference = screengrab_file_name + '_difference.png'
@JiggyPete
JiggyPete / gist:0979dc23f4470036ddd9
Created May 11, 2014 20:55
ScotlandJS 2014 Playlist
Friday:
Intro: Richard Strauss - Also Sprach Zarathustra
Angelina Fabbro: Muse - Hysteria
Philip Roberts: SBTRKT - Ready Set Loop
John Sutherland: Pérez Prado - Guagliano
Tom Ashworth: The Imperial March
Amanda O'Connell: Ray Conniff - 'S Wonderful
require 'set'
class UserPermissions
def initialize(user, cm_invoice)
@user = user
@cm_invoice = cm_invoice
end
def get_permissions