Skip to content

Instantly share code, notes, and snippets.

looking for new opportunities - let's have them!

Karol Bucek kares

looking for new opportunities - let's have them!
Block or report user

Report or block kares

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kares / password.rb
Created Jan 12, 2016 — forked from steakknife/password.rb
get password - Ruby - any platform - no gems needed
View password.rb
# Copyright 2012-2013 Barry Allard <>
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
View no-conn-pool.rb
# Monkeypatch to disable connection pooling in ActiveRecord
module ActiveRecord
module ConnectionAdapters
class ConnectionPool
def checkout
c = ActiveRecord::Base.send(spec.adapter_method, spec.config.dup)
kares / jruby-profile-to-string.rb
Last active Aug 29, 2015 — forked from danlucraft/jruby-profile-to-string.rb
printing JRuby profiler data output (examples)
View jruby-profile-to-string.rb
require 'jruby/profiler'
profile_data = JRuby::Profiler.profile do
# code to be profiled....
# print data in flat format to STDOUT :
profile_printer =
View postsql.sql
-- PostgreSQL 9.2 beta (for the new JSON datatype)
-- You can actually use an earlier version and a TEXT type too
-- PL/V8
-- Inspired by
-- JSON Types need to be mapped into corresponding PG types
kares /
Created May 23, 2012 — forked from Hakon/
JRuby::Rack with Rails send_file bug
require 'rubygems'
%w(action_controller/railtie).map &method(:require)
class JrubyRackTest < Rails::Application
config.secret_token = routes.append { root :to => 'send_file#deliver' }.inspect
run JrubyRackTest
kares / sessions.rake
Created Apr 14, 2011 — forked from yaroslav/sessions.rake
rake task for cleaning up ActiveRecord session store table from expired sessions
View sessions.rake
namespace :db do
namespace :sessions do
desc "Clean up expired Active Record sessions (updated before ENV['UPDATED_AT'], defaults to 1 month ago)."
task :expire => :environment do
time = Time.parse( ENV['UPDATED_AT'] || 1.month.ago.to_s(:db) )
say "cleaning up expired sessions (older than #{time}) ..."
session = ActiveRecord::SessionStore::Session
rows = session.delete_all ["updated_at < ?", time]
say "deleted #{rows} session row(s) - there are #{session.count} session row(s) left"
You can’t perform that action at this time.