Skip to content

Instantly share code, notes, and snippets.

View apotema's full-sized avatar

Alexandre Mondaini Calvão apotema

View GitHub Profile

Fellow Procorians,

I have spent most of my time with you working on the QuickBooks microservice and on a microservice to host the current HH2 Sage integration code.

I have seen some points of improvement on the Sage integration, one in particular is related to repeated code used to access HH2. For example:

commitment_change_order_conversation.rb

def flush_hh2_cco_queue(origin_id)
  retry_cntr ||= 1
Fellow Procorians,
I have spent part of my time working on the Quickbooks and on the HH2 system.
I have seen some points of improvement on the SAGE integration, one of them is related to repeated
code to access to the HH2 system. All along the code we can see this code to access the Hh2 systemm.
commitment_change_order_conversation.rb
```ruby
def flush_hh2_cco_queue(origin_id)
@apotema
apotema / include
Last active August 29, 2015 14:07
module Qbwc
module OrderedFields
module ClassMethods
def field attribute_name
@attr_order ||= []
@attr_order << attribute_name
attr_accessor attribute_name
end
def attr_order
@apotema
apotema / data_load.rb
Created November 24, 2012 19:49
Data load
require 'rubygems'
require 'sequel'
DB_MY = Sequel.connect('mysql://root@localhost/wikimapas_legacy')
DB_PG = Sequel.connect('postgres://alexandre@localhost/wikimaps_development')
categories_mysql = DB_MY[:categories].select{[id, name, created_at, updated_at]}
categories_ids = {}
categories_mysql.each do |category|
# my => pg
Connecting to database specified by database.yml
 (0.2ms) BEGIN
 (0.2ms) SAVEPOINT active_record_1
User Exists (0.9ms) SELECT 1 AS one FROM "users" WHERE "users"."email" = 'user_0@example.com' LIMIT 1
SQL (3.5ms) INSERT INTO "users" ("admin", "created_at", "disabled", "email", "latitude", "longitude", "name", "password_digest", "score", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) RETURNING "id" [["admin", true], ["created_at", Fri, 02 Nov 2012 00:25:26 BRST -02:00], ["disabled", nil], ["email", "user_0@example.com"], ["latitude", 1.1], ["longitude", 1.1], ["name", "user_name_0"], ["password_digest", "$2a$10$lX66IDibk4YndXHWUnPsTOga2JKVZ7OZ8C9XCHrWzOAjG92/ztEZC"], ["score", 0], ["updated_at", Fri, 02 Nov 2012 00:25:26 BRST -02:00]]
 (0.3ms) RELEASE SAVEPOINT active_record_1
 (0.5ms) SAVEPOINT active_record_1
User Exists (0.7ms) SELECT 1 AS one FROM "use