This file contains 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
var artNums = [ | |
"DV138501174HK", | |
"02002788399970580927", | |
"02002788399970580926", | |
"EG945761960US", | |
"92410944973202000000246909", | |
"9566700003681143083527", | |
"CA005338152RU", | |
"CA677001201US", | |
"EA272521142US", |
This file contains 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
/* | |
* Rewraps the elements in a table to the specified 'width'. If 'elements' | |
* is provided then populates the innerHTML of the cells of the specified | |
* 'table' using the data in the 'elements' array instead of re-using the | |
* elements already in the table. | |
* | |
* rewrapTableToWidth($('#myTable'), $(window).width()) | |
*/ | |
function rewrapTableToWidth(table, width, elements) { | |
table = typeof(table[0]) != "undefined" ? table[0] : table; |
This file contains 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 | |
@my_number = (rand(10) + 1).to_s | |
@tries = 10 | |
def try | |
print "Tries left = #{@tries -= 1}: Guess my number (1..10): " | |
gets.chomp == @my_number rescue puts "<nil input>" | |
end |
This file contains 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
/* | |
* public void setLookupDao(LookupDao lookupDao) { this.lookupDao = | |
* lookupDao; String timeoutStr = | |
* getLookupDao().lookupSingleValueByKey("DEFAULT_WEBTOOLS_CLIENT_TIMEOUT"); | |
* try { setTimeout(Integer.valueOf(timeoutStr)); } catch | |
* (NumberFormatException e) {logDebug( | |
* "Failed to assign timeout for EnhancedHttpClient because LookupDao value for DEFAULT_WEBTOOLS_CLIENT_TIMEOUT is '" | |
* +timeoutStr+"'"); } } | |
*/ |
This file contains 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.itcadre.adapt.hibernate; | |
// Generated Apr 1, 2011 10:29:11 PM by Hibernate Tools 3.4.0.CR1 | |
import javax.ejb.Stateless; | |
import javax.persistence.EntityManager; | |
import javax.persistence.PersistenceContext; | |
import org.apache.commons.logging.Log; | |
import org.apache.commons.logging.LogFactory; |
This file contains 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.itcadre.adapt.hibernate; | |
// Generated Apr 1, 2011 10:29:11 PM by Hibernate Tools 3.4.0.CR1 | |
import java.util.Date; | |
import javax.persistence.Column; | |
import javax.persistence.Entity; | |
import javax.persistence.GeneratedValue; | |
import javax.persistence.Id; | |
import javax.persistence.Table; |
This file contains 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 | |
This file contains 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 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 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 |