Skip to content

Instantly share code, notes, and snippets.

@machineboy2045
machineboy2045 / string_intersection.rb
Created February 3, 2016 15:48
String intersection
def string_intersection(strings, key = 0, intersection = '')
letter = strings.first[key]
return if letter.nil?
if strings.map {|str| str[key] == letter}.all?
return string_intersection(strings, key + 1, intersection + letter)
else
return intersection
end
end
@machineboy2045
machineboy2045 / main.js
Created February 9, 2014 14:39
deep watch object and log to console
$scope.$watch('myOjbect', function(curr){
console.log(curr);
},true)