Skip to content

Instantly share code, notes, and snippets.

@namakesugi
namakesugi / stf_error
Created December 31, 2011 17:39
STF `cpanm --installdeps .` failed on perl 5.14
# perlbrew install perl-5.14.2
Fetching perl-5.14.2 as /root/perl5/perlbrew/dists/perl-5.14.2.tar.gz
Installing /root/perl5/perlbrew/build/perl-5.14.2 into ~/perl5/perlbrew/perls/perl-5.14.2
This could take a while. You can run the following command on another shell to track the status:
tail -f ~/perl5/perlbrew/build.log
Installed /root/perl5/perlbrew/build/perl-5.14.2 as perl-5.14.2 successfully. Run the following command to switch to it.
@namakesugi
namakesugi / levenshtein_distance.rb
Created December 24, 2011 15:59
LevenshteinDistance
# coding: utf-8
class LevenshteinDistance
def self.analyze(str1, str2, options = {})
_options = {:insert_cost => 1, :delete_cost => 1, :replace_cost => 1}.merge(options)
# remove Line feed code
x = str1.chomp
y = str2.chomp
return 0 if x == y