TCP socket connection with TLS.
Uses JSON to represent the message (http://en.wikipedia.org/wiki/JSON).
{
| require 'rubygems' | |
| require "builder" | |
| require "benchmark" | |
| require 'nokogiri' | |
| require 'erb' | |
| require 'erubis' | |
| ITERATIONS = 1_000 | |
| ERB_TEMPLATE = <<-EOL |
| # sudo gem install bson | |
| # sudo gem install bson_ext | |
| # sudo gem install yajl-ruby | |
| # sudo gem install json | |
| # sudo gem install msgpack | |
| require 'rubygems' | |
| require 'benchmark' | |
| require 'yaml' | |
| require 'bson' |
| ACCOUNT_ID = 2 | |
| NUMBER_OF_JOBS = 1_000 | |
| class PopulateJobs | |
| def create_job(index) | |
| job = @account.intervals.new(:name => "Job #{index}") | |
| location = Location.new(:formatted_address => "12 Heather Street, Auckland, Parnell, New Zealand", :lat => 123.2342, :lng => 37.234232) |
| ACCOUNT_ID = 2 | |
| NUMBER_OF_JOBS = 1_000 | |
| class PopulateJobs | |
| def create_job(index) | |
| job = @account.intervals.new(:name => "Job #{index}") | |
| location = Location.new(:formatted_address => "12 Heather Street, Auckland, Parnell, New Zealand", :lat => 123.2342, :lng => 37.234232) | |
| job.milestones.build({:location => location, :milestone_type => "Start", :sequence_order => 0, :planned_duration => 0}) |
TCP socket connection with TLS.
Uses JSON to represent the message (http://en.wikipedia.org/wiki/JSON).
{
| require 'openssl' | |
| require 'digest/sha1' | |
| ENCRYPT_METHOD = "aes-256-cbc" | |
| API_KEY = "YOUR_VWORKAPP_API_KEY" | |
| # What you have to do | |
| c = OpenSSL::Cipher::Cipher.new(ENCRYPT_METHOD) | |
| c.encrypt | |
| # your pass is what is used to encrypt/decrypt |
| require 'eventmachine' | |
| require 'evma_httpserver' | |
| class MyHttpServer < EventMachine::Connection | |
| include EventMachine::HttpServer | |
| def post_init | |
| super | |
| ssl_dir = File.join(File.dirname(__FILE__), "ssl") | |
| server_key = File.join(ssl_dir, "server.key") |
| // ------------------------------------------------------------------------------------------------------------------// | |
| // vWorkApp Core Library | |
| // ------------------------------------------------------------------------------------------------------------------// | |
| var vWorkAppScript = vWorkAppScript || {}; | |
| vWorkAppScript.host = "api.vworkapp.com"; | |
| vWorkAppScript.apiToken = "PUT YOUR API KEY HERE" | |
| (function() { |
| require "benchmark" | |
| require "mongoid" | |
| require "bloomfilter-rb" | |
| module BloomFilter | |
| class Native | |
| def self.unpack(str) | |
| bitstring = str.unpack("B*").first | |
| bytes = [] |
| body { | |
| font-family: sans serif; | |
| background-color: white; | |
| font-family: georgia; | |
| font-size: 15px; | |
| margin: 20px; | |
| } | |
| ul { | |
| list-style-type: square; |