Skip to content

Instantly share code, notes, and snippets.

View zm69's full-sized avatar
🎧
Focusing

Oleh zm69

🎧
Focusing
  • Canada
  • 17:21 (UTC -05:00)
View GitHub Profile
@zm69
zm69 / 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
@zm69
zm69 / .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:
@zm69
zm69 / 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
// Just an idea, not sure if it is any good
I have next procs to work with vkPhysicalDevice:
physical_device__get_extensions :: proc(device: vk.PhysicalDevice, allocator := context.temp_allocator) -> (exts: []vk.ExtensionProperties, res: vk.Result)
physical_device__find_swapchain_support :: proc(device: vk.PhysicalDevice, surface: vk.SurfaceKHR, allocator := context.temp_allocator) -> (support: Swapchain_Support, result: vk.Result)
physical_device__find_queue_families :: proc(device: vk.PhysicalDevice, surface: vk.SurfaceKHR) -> (ids: Queue_Family_Indices, ok: bool)
physical_device__score :: proc(vk_device: vk.PhysicalDevice, vk_surface: vk.SurfaceKHR) -> (pdd: Physical_Device_Data)
In my package I have global variable g_physical_device (it could be local variable too, it doesn't matter).
@zm69
zm69 / gist:9d80a13d2a9103ae296d1cd600ff89ef
Last active October 18, 2024 21:07
allow_question_mark_at_the_end_of_proc_names
// Allow question mark(?) at the end of ODIN proc names. It works like that in Ruby language and is very nice.
// REASON: Improves readability a lot.
// Also maybe at the end of any constant?
old:
is_pipeline_initialized :: proc() -> bool {
}
if is_pipeline_initized {
}
@zm69
zm69 / procspace.md
Last active November 9, 2024 20:12
Odin procspace

procspace


One more level of "namespacing" but for procedures only (cannot include anything but procedures). Makes package APIs much nicer because logically grouped by nouns. Cannot be nested.

Package example:

package ecs