Skip to content

Instantly share code, notes, and snippets.

@romansklenar
romansklenar / tollers-sk.txt
Created December 15, 2023 22:41
List of tollers born in and imported to 🇸🇰
Abby's Ninja Cole z Jesenicke smecky
Abby's Ninja Jay z Jesenicke smecky
Alexa Cherubic Soul
Alfie Amadeus Cherubic Soul
Alice Tipota Red Fox
Aliya Cherubic Soul
Amalia Cherubic Soul
Amalka Tipota Red Fox
Amalka z Kotarskych luk
Amber Cherubic Soul
@romansklenar
romansklenar / gwi.puml
Created December 18, 2019 19:28
GWI puml definition
!define GWI_BG_COLOR #d4007b
!define GWI_BORDER_COLOR #abcdef
skinparam rectangle<<gwi_system>> {
StereotypeFontColor ELEMENT_FONT_COLOR
FontColor #ELEMENT_FONT_COLOR
BackgroundColor GWI_BG_COLOR
BorderColor GWI_BORDER_COLOR
}
@romansklenar
romansklenar / db.rake
Created April 1, 2015 18:08
Useful rake task for maintain PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc 'Maintains database by running command as ANALYZE, VACUUM and REINDEX'
task maintain: :environment do
verbose = ENV['VERBOSE'].present?
connection = ActiveRecord::Base.connection
puts "Maintaining database #{connection.current_database} ..."
connection.execute("VACUUM FULL #{'VERBOSE' if verbose}")
@romansklenar
romansklenar / devise.cs.yml
Last active August 29, 2015 14:08 — forked from jnv/devise.cs.yml
Czech translation for Devise 3.4
# Additional translations at http://github.com/plataformatec/devise/wiki/I18n
cs:
errors:
messages:
already_confirmed: 'byl již potvrzen, prosím, zkuste se přihlásit'
confirmation_period_expired: 'musí být potvrzen během %{period}, požádejte prosím o nový'
expired: 'vypršel, požádejte prosím o nový'
not_found: 'nenalezen'
not_locked: 'nebyl uzamčen'
@romansklenar
romansklenar / commands.sh
Created April 26, 2014 17:28
Rails 4.1 application update diff
rails _3.2.15_ new rails_update --database=postgresql --skip-bundle
rails _4.1.0_ new rails_update --database=postgresql --skip-bundle
class Player
def play_turn(warrior)
warrior.walk!
end
end
@romansklenar
romansklenar / crosstab.sql
Last active February 1, 2023 18:46
PostgreSQL "pivot table" example using tablefunc extension
CREATE EXTENSION tablefunc;
CREATE TABLE sales(year int, month int, qty int);
INSERT INTO sales VALUES(2007, 1, 1000);
INSERT INTO sales VALUES(2007, 2, 1500);
INSERT INTO sales VALUES(2007, 7, 500);
INSERT INTO sales VALUES(2007, 11, 1500);
INSERT INTO sales VALUES(2007, 12, 2000);
INSERT INTO sales VALUES(2008, 1, 1000);
INSERT INTO sales VALUES(2009, 5, 2500);
@romansklenar
romansklenar / 20131118172653_create_transactional_items_view.rb
Last active July 3, 2017 09:15
Using PostgreSQL's materialized views as background for ActiveRecord models for flexible statistics
# db/migrate/20131118172653_create_transactional_items_view.rb
class CreateTransactionalItemsView < ActiveRecord::Migration
def up
select_sql = File.open("#{Rails.root}/db/migrate/20131118172653_create_transactional_items_view.sql", 'r') { |f| f.read }
# for materialized view:
view_sql = "CREATE MATERIALIZED VIEW transactional_items AS (#{select_sql})"
# for normal view:
view_sql = "CREATE VIEW transactional_items AS (#{select_sql})"
@romansklenar
romansklenar / rails_proficiency.txt
Created December 4, 2013 20:11
Proficiency requirements for Rails developer
Senior (enterprise)
Analyse and profile an application for performance and memory issues
Analyses and profile an application for security issues
Understand database modeling and query analysis
Tune a production deployment (Passenger, Thin, Apache etc)
Understand and use Ruby metaprogramming
Mentoring skills
Communication skills
Planning and Estimation