This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .svn/prop-base/ZipCodeLookUp.java.svn-base: | |
| K 13 | |
| svn:eol-style | |
| V 6 | |
| native | |
| END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.usps.webservice.msg; | |
| public class ResponseWrapper<E> { | |
| private Object response = null; | |
| public ResponseWrapper(E response) { | |
| this.response = response; | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Source < ActiveRecord::Base | |
| belongs_to :owner | |
| def self.create_from_pathname(pathname) | |
| source = Source.new({:path => "", :tracename => ""}) | |
| end | |
| private |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # call-seq | |
| # get_owner_from_svn_log(Pathname("path/to/source.java")) => owner_name | |
| # | |
| # if 'pathname' doesn't exist or there is no commit history then returns nil | |
| def self.get_owner_from_svn_log(pathname) | |
| log = `svn log #{pathname}` | |
| first_commit_time = nil | |
| commits = [] | |
| log.each do |line| | |
| commits << [$1, first_commit_time = Time.parse($2)] if line =~ /^\w+? \| (\w+?) \| (.+?) \(.+?\) \| / |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # call-seq | |
| # get_owner_from_svn_log(Pathname("path/to/source.java")) => owner_name | |
| # | |
| # if 'pathname' doesn't exist or there is no commit history then returns nil | |
| def self.get_owner_from_svn_log(pathname) | |
| log = `svn log #{pathname}` | |
| first_commit_time = nil | |
| committers = Hash.new(0) | |
| log.reverse_each do |line| | |
| if line =~ /^\w+? \| (\w+?) \| (.+?) \(.+?\) \| / |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'pathname' | |
| require 'lib/database_utils' | |
| DatabaseUtils.establish_connection | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_owner_or_init_from_svn | |
| unless self.owner | |
| owner_name = Source.get_owner_from_svn_log(self.path) | |
| if owner_name | |
| self.owner = Owner.find_or_create_by_name(owner_name) | |
| self.save! | |
| end | |
| end | |
| return self.owner | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Owner < ActiveRecord::Base | |
| belongs_to :owner | |
| # fields: name, fullname, email, phone, owner_id | |
| def self.find_incomplete_owners | |
| Owner.find(:all, :conditions => "fullname is null or email is null") | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on_data_proc = lambda do |ch, data| | |
| log.puts "out: #{data}" | |
| channel.send_data("yes\n") if data =~ /continue connecting \(yes\/no\)/i | |
| channel.send_data("#{cmds["password"]}\n") if data =~ /Password/i | |
| if data =~ /Last login:/i | |
| log.puts "logged in" | |
| process_cmds(cmds, nest+1, params) | |
| log.puts "processing nested commands finished" | |
| channel.on_data do |ch, data| | |
| on_data_proc.call(ch, data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # The Levenshtein distance between two strings is defined as the minimum number | |
| # of edits needed to transform one string into the other, with the allowable | |
| # edit operations being insertion, deletion, or substitution of a single character. | |
| # | |
| # see: | |
| # http://en.wikipedia.org/wiki/Levenshtein_distance | |
| # http://en.wikibooks.org/wiki/Algorithm_implementation/Strings/Levenshtein_distance#Ruby | |
| # https://github.com/threedaymonk/text/blob/master/lib/text/levenshtein.rb | |