Skip to content

Instantly share code, notes, and snippets.

View ludyna's full-sized avatar
🎧
Focusing

Oleh Novosad ludyna

🎧
Focusing
View GitHub Profile
@ludyna
ludyna / locks_and_blocking.sql
Last active August 17, 2018 18:54
PSQL blocking related queries
--------- Blocked statement and count
SELECT count(current_statement_in_blocking_process), db.current_statement_in_blocking_process FROM (
SELECT DISTINCT blocked_locks.pid AS blocked_pid,
blocked_activity.usename AS blocked_user,
blocking_activity.query AS current_statement_in_blocking_process
FROM pg_catalog.pg_locks blocked_locks
JOIN pg_catalog.pg_stat_activity blocked_activity ON blocked_activity.pid = blocked_locks.pid
JOIN pg_catalog.pg_locks blocking_locks
ON blocking_locks.locktype = blocked_locks.locktype
AND blocking_locks.DATABASE IS NOT DISTINCT FROM blocked_locks.DATABASE
@ludyna
ludyna / fjfj.rb
Created March 29, 2018 22:25
sadlfjdslkf
class Some
end
obj = Some.new
class << obj
def hello
puts 'hello'
end
end
@ludyna
ludyna / nested_dci_contexts.rb
Last active March 20, 2018 20:06
Nested DCI Contexts
#
# Example: Nested DCI Contexts
# Blog post: https://www.ludyna.com/oleh/dci-in-scale-free-fractal-way
#
# Note that Ruby language while supporting multiple programming paradigms does not
# natively support DCI paradigm. I am using classes and modules to express Context,
# Data and Roles concepts from DCI.
module GameWorldContext
@ludyna
ludyna / .tmux.conf
Last active August 29, 2015 14:15 — forked from v-yarotsky/.tmux.conf
tmux config
#
# Oleh's tmux config
#
# INSTALLATION NOTES
# 1. Install Homebrew (https://github.com/mxcl/homebrew)
# 2. brew install zsh
# 3. Install OhMyZsh (https://github.com/robbyrussell/oh-my-zsh)
# 4. brew install reattach-to-user-namespace --wrap-pbcopy-pbpaste && brew link reattach-to-user-namespace
# 5. Install iTerm2
# 6. In iTerm2 preferences for your profile set:
@ludyna
ludyna / dci_example.rb
Last active March 20, 2018 20:08
DCI (Data, Contexts, Interactions) paradigm example in Ruby
# DCI EXAMPLE IN RUBY (with some prototype elements)
# Blog post: https://www.ludyna.com/oleh/dci-example-in-ruby
#
# More info:
#
# Creator of MVC & DCI, Trygve Reenskaug: DCI: Re-thinking the foundations of
# object orientation and of programming
# http://vimeo.com/8235394
#
# James Coplien: Why DCI is the Right Architecture for Right Now