Skip to content

Instantly share code, notes, and snippets.

View flash-gordon's full-sized avatar
🔪
Working on sharp tools

Nikita Shilnikov flash-gordon

🔪
Working on sharp tools
View GitHub Profile
@flash-gordon
flash-gordon / Gemfile
Created June 6, 2016 17:07
repo example
source "https://rubygems.org"
ruby "2.3.1"
# Web framework
gem "dry-web", github: "dry-rb/dry-web"
# Database persistence
gem "sqlite3"
gem "rom", github: "rom-rb/rom"
create type node as object(
left_node anydata,
right_node anydata,
value anydata
);
/
declare
op node;
begin
MERGE INTO TT_PAY_REQ_SERVICES T
USING (
SELECT T.N_LINE_ID,
T.N_AMOUNT_REQ -
GREATEST(LEAST(
T.N_AMOUNT_REQ,
A.N_AVAILABLE_AMOUNT -
COALESCE(
SUM(T.N_AMOUNT_REQ)
OVER(PARTITION BY T.N_ACCOUNT_ID
machine:
java:
version: openjdk7
environment:
RAILS_ENV: test
JRUBY_OPTS: -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -X-C -Xcompile.invokedynamic=false --1.9 -J-Xmx2g
dependencies:
cache_directories:
- '~/.rvm/rubies'
#!/usr/bin/env ruby
require 'rom-sql'
require 'rom/sql/commands/postgres'
conn = Sequel.connect('postgres://localhost/upsert_example')
conn.drop_table?(:quotes)
conn.create_table :quotes do
require 'json'
require 'uri'
require 'net/http'
require 'rom'
require 'rom-http'
module Types
include Dry::Types.module
end
Bundler.setup(:default, :benchmarks)
Bundler.require
require 'benchmark'
require 'benchmark/ips'
ATTRS = ('a'..'z').to_a.map(&:to_sym).take(10)
class ManualStruct
class_eval(<<-RUBY)
Bundler.setup(:default, :benchmarks)
Bundler.require
require 'benchmark'
require 'benchmark/ips'
b = { b: :b }
Benchmark.ips do |x|
x.report('merge') { { a: :a }.merge(b) }
@flash-gordon
flash-gordon / pg_inferrer.rb
Created September 7, 2016 13:12
custom inferrer
require 'rom/sql/types/pg'
module ROM
module SQL
class Schema
class PGInferrer < Inferrer
# define all pg specific logic here
end
end
end

Keybase proof

I hereby claim:

  • I am flash-gordon on github.
  • I am flashgordon (https://keybase.io/flashgordon) on keybase.
  • I have a public key whose fingerprint is 4171 2454 F1FB C02B 5846 950E E569 D1D6 4C40 E241

To claim this, I am signing this object: