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.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 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.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 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
| /* | |
| * 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 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 | |
| @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 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
| /* | |
| * 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 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
| var artNums = [ | |
| "DV138501174HK", | |
| "02002788399970580927", | |
| "02002788399970580926", | |
| "EG945761960US", | |
| "92410944973202000000246909", | |
| "9566700003681143083527", | |
| "CA005338152RU", | |
| "CA677001201US", | |
| "EA272521142US", |
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
| erb_eval_mode = line =~ /^%ERB_START_EVAL/ if line =~ /^%ERB_START_EVAL|%ERB_STOP_EVAL/ | |
| if line =~ /^%ERB_START_EVAL/ | |
| erb_eval_mode = true | |
| if line =~ /^%ERB_STOP_EVAL/ | |
| erb_eval_mode = false |
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
| 1.9.2p320 :001 > s = "test: string with @ref and @ref2 in it" | |
| => "test: string with @ref and @ref2 in it" | |
| 1.9.2p320 :002 > s.scan(/(?<=@)\w+/) | |
| => ["ref", "ref2"] | |
| 1.9.2p320 :003 > s.scan(/@(\w+)/) | |
| => [["ref"], ["ref2"]] |
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
| require'socket' | |
| server = TCPServer.new(8088); | |
| loop do | |
| connection = server.accept | |
| puts 'Trapped a new connection' | |
| 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
| # Register - Step 1 (login): Authenticate using fuzzy card number as 'login' and last name as 'password' (note auth will fail if Card.Reg == 1 already) | |
| curl -i -H "Accept: application/json" -X POST -d "api_user_session[retailer_id]=767&api_user_session[type]=Card&api_user_session[login]=40000000197&api_user_session[password]=Vandalay" http://local.webstophq.com:3000/api/v1/login | |
| # Register - Step 2 (get preferred store list): Gets list of {:id, :store_number, :address_1, :city, :store_name} | |
| GET /api/v1/retailers/:retailer_id/stores(.:format) | |
| curl -i -H "Accept: application/json" http://local.webstophq.com:3000/api/v1/retailers/767/stores?api_user_credentials=tozaqJaMRDKPjXPWhDh | |
| # Register - Step 3 (update consumer): Mark Consumer (Card) as registered and set preferred store and password - then return the Consumer (Card) including new single_access_token and legacy_token | |
| PUT /api/v1/retailers/:retailer_id/consumers/:id(.:format) | |
| curl -i -H "Accept: application/json" -X PUT -d "consumer[registered]=1&co |