Skip to content

Instantly share code, notes, and snippets.

View Sparkboxx's full-sized avatar

Wilco van Duinkerken Sparkboxx

View GitHub Profile
require 'zeus/rails'
ROOT_PATH = File.expand_path(Dir.pwd)
ENV_PATH = File.expand_path('spec/dummy/config/environment', ROOT_PATH)
BOOT_PATH = File.expand_path('spec/dummy/config/boot', ROOT_PATH)
APP_PATH = File.expand_path('spec/dummy/config/application', ROOT_PATH)
ENGINE_ROOT = File.expand_path(Dir.pwd)
ENGINE_PATH = File.expand_path('lib/my_engine/engine', ENGINE_ROOT)
class CustomPlan < Zeus::Rails

Using OpeNER webservices using Curl

You can use the opener webservices using Curl. All components, except the language identifier, take KAF (XML) as input and output KAF. Only the language identifier takes "raw text" as an input.

To send a text to the language identifier you can use curl with the -F option to have curl read text out of files, like this:

Testmachines
anakin.holder.nl -> Centos 5.4 on vmware, 32 bit, 1 core, 4G ram, while running a complete production stack with multiple website.
server1 @terremark -> Centos 5.4 on vmware, 32 bit, 1core, 4g ram, empty machine.
Test 1: Extracting linux kernel sources
Command: time tar xf linux-2.6.34.1.tar
Terremark: 7.329s
Anakin: 2.395s
class Currency
def self.string_to_float(string)
string.gsub!(/[^\d.,]/,'') # Replace all Currency Symbols, Letters and -- from the string
if string =~ /^.*[\.,]\d{1}$/ # If string ends in a single digit (e.g. ,2)
string = string + "0" # make it ,20 in order for the result to be in "cents"
end
unless string =~ /^.*[\.,]\d{2}$/ # If does not end in ,00 / .00 then
string = string + "00" # add trailing 00 to turn it into cents