Skip to content

Instantly share code, notes, and snippets.

View Bor1s's full-sized avatar
🏠
Working from home

Borys Babusenko Bor1s

🏠
Working from home
  • onrunning
  • World
View GitHub Profile
@Bor1s
Bor1s / lru_cache_ts_README.md
Created February 25, 2026 14:29
LRU Cache — TypeScript pair programming exercise

LRU Cache — TypeScript

An in-memory cache implementation that expires the least recently used items, and limits cache size by a maximum number of items.

API

A cache object can be instantiated in memory. It requires the max number of records as an argument:

const cache = new Cache<string>({ maxSize: 100 });
@Bor1s
Bor1s / show_all_i18n.rb
Last active September 12, 2018 08:44
Script to show all nested I18n
def key_paths(key, hash_or_string)
if hash_or_string.is_a?(Hash)
hash_or_string.keys.map do |subkey|
key_paths([key, subkey].compact.join("."), hash_or_string[subkey])
end
else
key
end
end
@Bor1s
Bor1s / SOLID.markdown
Created December 21, 2017 11:40 — forked from emaraschio/SOLID.markdown
SOLID Principles with ruby examples

#SOLID Principles with ruby examples

##SRP - Single responsibility principle A class should have only a single responsibility.

Every class should have a single responsibility, and that responsibility should be entirely encapsulated. All its services should be narrowly aligned with that responsibility, this embrace the high cohesion.

##OCP - Open/closed principle Software entities should be open for extension, but closed for modification.

@Bor1s
Bor1s / simulate_scanned_PDF.md
Created December 8, 2017 08:17
Simulate a scanned PDF with ImageMagick

Simulate a scanned PDF with ImageMagick

  1. Download and install Ghostscript and ImageMagick + Convert Module
  2. Execute the following command in the console (change the filename)
$ convert -density 200 INPUT.pdf -rotate 0.3 +noise Multiplicative -format pdf  -quality 85 -compress JPEG -colorspace gray OUTPUT.pdf

Description of the options

  • -density: set the input DPI to 200
  • -rotate: set Page rotation to 0.3 degrees
@Bor1s
Bor1s / docker-pry-rails.md
Created July 6, 2017 17:46 — forked from briankung/docker-pry-rails.md
Using pry-rails with Docker