Skip to content

Instantly share code, notes, and snippets.

@victormier
victormier / gist:9671147
Created March 20, 2014 18:53
Codewars: Largest Difference in Increasing Indexes
var largestDifference = function(data) {
var diff = data.length - 1,
i;
while(diff > 0) {
for(i = 0; i + diff < data.length; i++) {
if (data[i] <= data[i + diff]) {
return diff;
}
}
# Expectations
must_have_button
wont_have_button
must_have_checked_field
wont_have_checked_field
must_have_content
wont_have_content
@victormier
victormier / gg_replace
Last active December 29, 2015 09:39
Simple git grep replace for bash written in ruby. Replaces all instances of a string in any tracked file. Based on https://gist.github.com/jcamenisch/1671995 Allows strings with whitespaces.
#!/usr/bin/env ruby
if ARGV.length != 2
puts "Usage:"
puts ' gg_replace term replacement'
puts
puts 'Example:'
puts ' gg_replace "bad cappuchino" "fine cappuccino"'
exit
end