Skip to content

Instantly share code, notes, and snippets.

View Kukunin's full-sized avatar

Sergiy Kukunin Kukunin

View GitHub Profile
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required.'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rom'
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required.'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rom'
@Kukunin
Kukunin / rom_value_object_persistence.rb
Last active February 9, 2017 10:47
ROM value object persistence
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required.'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rom', git: 'https://github.com/rom-rb/rom.git'
@Kukunin
Kukunin / customers_mapper.rb
Last active January 15, 2017 18:22
Transproc Transformer as ROM Mapper
module RomInterface
def self.extended(klass)
klass.extend ROM::ClassMacros
klass.defines :relation, :register_as
end
def base_relation
relation
end
@Kukunin
Kukunin / poland-consulate.user.js
Last active January 24, 2025 17:53
Userscript for automatic appointment checking for Poland Consulate in Ukraine. Contact me, if you want a ready-to-use solution
// ==UserScript==
// @name Poland Visa Applicator
// @namespace http://e-konsulat.gov.pl/
// @version 0.1
// @description Brute Force the visa application page
// @author Serhii Kukunin <[email protected]>
// @match https://secure.e-konsulat.gov.pl/Uslugi/RejestracjaTerminu.aspx*
// @grant none
// @
@Kukunin
Kukunin / gist:4e93d254eaad1ee23bfe
Created November 7, 2014 22:40
carrierwave_upload_cache_bug.rb
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'rack', github: 'rack/rack'
gem 'i18n', github: 'svenfuchs/i18n'
gem 'carrierwave', github: 'carrierwaveuploader/carrierwave'
gem 'sqlite3'
GEMFILE
@Kukunin
Kukunin / accepts_nested_attributes_for_bug.rb
Created September 17, 2014 19:48
Rails belongs_to, accepts_nested_attributes_for and not typical model name bug
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'rack', github: 'rack/rack'
gem 'i18n', github: 'svenfuchs/i18n'
gem 'sqlite3'
GEMFILE
@Kukunin
Kukunin / onresourceloaded.js
Created June 30, 2014 19:44
PhantomJS module to implement robust onLoadFinished callback, supporting redirects, JS resource loading etc
function addAllResourcesLoadedCallback(page, timeout) {
function debug(text) {
if (typeof page.onDebug == "function") {
page.onDebug(text);
}
}
var counter = [], timer;
timeout = timeout || 2000;