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
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 <barry.allard@gmail.com>
# 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)
c.verify!
c
end
@kares
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....
end
# print data in flat format to STDOUT :
profile_printer = JRuby::Profiler::FlatProfilePrinter.new(profile_data)
profile_printer.printProfile(STDOUT)
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 http://code.google.com/p/plv8js/wiki/PLV8
-- Inspired by
-- http://people.planetpostgresql.org/andrew/index.php?/archives/249-Using-PLV8-to-index-JSON.html
-- http://ssql-pgaustin.herokuapp.com/#1
-- JSON Types need to be mapped into corresponding PG types
--
@kares
kares / rackup.ru
Created May 23, 2012 — forked from Hakon/rackup.ru
JRuby::Rack with Rails send_file bug
View rackup.ru
require 'rubygems'
%w(action_controller/railtie).map &method(:require)
class JrubyRackTest < Rails::Application
config.secret_token = routes.append { root :to => 'send_file#deliver' }.inspect
initialize!
end
run JrubyRackTest
@kares
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"
end
You can’t perform that action at this time.