Skip to content

Instantly share code, notes, and snippets.

import * as odbc from 'odbc';
async function connectToDenodo() {
const connectionString = `Driver={DenodoODBC};
Server=your_denodo_server_address;
Port=9999;
UID=your_username;
PWD=your_password;`;
let connection;
class ProcInterface
def test
'234'
end
end
procedure = -> (i) { i.test }
procedure.call(ProcInterface.new)
module V1
class ChequeTransactionsController < TransactionsController
before_filter :check_if_selected, only: :set_cheque_number
def show
authorize Transaction
transactions = ChequeTransactionsIndex.query(params[:query]) { |scope|
paginated_collection(filtered_transactions(scope))
}.preload(:funding_processing, { real_transaction: :transaction_transitions })
respond_with transactions, each_serializer: ChequeShortTransactionSerializer, root: :transactions
@meskallito
meskallito / gist:5288591020f64259a4e3
Created June 9, 2014 21:37
Inserting of custom diff logic
class AlterDiffLogicForInvoiceCharges < ActiveRecord::Migration
def change
alter_diff_calculations :invoice_charges, %{
excluded_cols := array_cat(excluded_cols,'{user_id, properties}'::text[]);
changes = ((hstore(NEW.*) - hstore(OLD.*)) - excluded_cols) || (hstore(NEW.properties) - hstore(OLD.properties));
}
end
end
@meskallito
meskallito / gist:8198900
Last active January 1, 2016 20:48
Rubinius vs MRI
flow.task do
2.times do
25_000_000.times {}
end
end
MRI 2.400000 0.000000 2.400000 ( 2.398510)
Rubinius 0.834417 0.000243 0.834660 ( 0.830375)
2.times do

One big flow -> SQL Query is not in flow

Rubinius

  • 200 => 32s
  • 400 => 59s
  • 800 => 132s

Ruby

  • 200 => 34.4s
  • 400 => 86s
@meskallito
meskallito / gist:7996847
Last active December 31, 2015 13:59
MRI
user system total real
total 38.500000 1.500000 40.000000 ( 40.701780)
user system total real
employee 1 0.220000 0.010000 0.230000 ( 0.227093)
user system total real
employee 2 0.130000 0.000000 0.130000 ( 0.129894)
user system total real
Thread ID: 70345536568920
Fiber ID: 70345596069720
Total: 0.090674
Sort by: self_time
%self total self wait child calls name
0.04 0.000 0.000 0.000 0.000 3 *Hash#each_pair
0.04 0.000 0.000 0.000 0.000 15 ActiveSupport::HashWithIndifferentAccess#convert_key
0.04 0.000 0.000 0.000 0.000 12 *ActiveSupport::HashWithIndifferentAccess#convert_value
0.03 0.000 0.000 0.000 0.000 36 Kernel#is_a?
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
# Following user should use 'Authorization' http header: Basic YWRtaW5AZXhhbXBsZS5jb206MTIzNDU2
require 'factory_girl'
FactoryGirl.find_definitions
module PiProcessing
class TaskInitializer
attr_accessor :result
def initialize(flow, shared_context, tokens)
@flow = flow
@shared_context = shared_context
@dependency_manager = DependencyManager.new(tokens)
end