Skip to content

Instantly share code, notes, and snippets.

View v-kolesnikov's full-sized avatar
✍️
I'm writing something just now! You can write me too! 😉

Vasily Kolesnikov v-kolesnikov

✍️
I'm writing something just now! You can write me too! 😉
View GitHub Profile
CommonJS
ESM
AMD
ES modules
ES6 modules
mjs
import, export
script defer
@v-kolesnikov
v-kolesnikov / index.md
Last active July 25, 2023 20:37
My CS conspects

CS Notes

Or what I would like to know clear (ясно).

  • bytes (despite I know bits quite well)
  • byte-strings
  • encodings
  • packing & unpacking bytes (Ruby Array#pack & String#unpack etc)

Bit

@v-kolesnikov
v-kolesnikov / uuid.rb
Created July 24, 2023 15:51 — forked from brandur/uuid.rb
UUID data type in Ruby
# typed: strict
# frozen_string_literal: true
require "base32"
require "securerandom"
require "ulid"
# A type to represent UUIDs. Particularly useful for annotating fields in API
# representations or Sorbet parameters to help prevent accidentally mixing up
# UUIDs and EIDs as they're being passed around as loose strings.
@v-kolesnikov
v-kolesnikov / coverage.rb
Created January 29, 2023 11:34
Coverage groups
# https://github.com/jeremyevans/forme/blob/master/spec/forme_coverage.rb
require 'coverage'
require 'simplecov'
def SimpleCov.forme_coverage(opts = {})
start do
enable_coverage :branch
add_filter "/spec/"
add_group('Missing'){|src| src.covered_percent < 100}
add_group('Covered'){|src| src.covered_percent == 100}
opts[:max_dataset_size]
It is a very important constant that provides a useful performance optimization.
For example we have N records in `users` table and want to show that number
under the corresponding table on `/users` page. It would be quite fast for DB
to count some tausands records and return that value back to the application.
But in case of 1M records the same task will load the DB server significantly
and without the relevant reason. There is no difference for web-app purposes
whether we have 1M or 1M+1 records in the DB .
audit=false
engine-strict=true
fund=false
legacy-peer-deps=false

Bookmate Tech Stack

Backend

Primary technologies

  • Ruby
  • Ruby on Rails (v.6 at 12/22)
  • Sidekiq
  • MySQL
@v-kolesnikov
v-kolesnikov / hugofastsearch.md
Created June 22, 2022 13:52 — forked from cmod/hugofastsearch.md
Fast, instant client side search for Hugo static site generator

Super fast, keyboard-optimized, client side Hugo search

This is a fork of and builds upon the work of Eddie Webb's search and Matthew Daly's search explorations.

It's built for the Hugo static site generator, but could be adopted to function with any json index compatible with Fuse fuzzy search library.

To see it in action, go to craigmod.com and press CMD-/ and start typing.

Fast Search

@v-kolesnikov
v-kolesnikov / ll.rb
Created October 6, 2021 09:39
Gem licenses ruby
text = Gem.loaded_specs.map do |name, spec|
"#{name};#{spec.licenses.join(', ')}"
end.join("\n")
puts text
@v-kolesnikov
v-kolesnikov / roda_pipeline.rb
Created June 30, 2021 23:12
Phoenix-like `pipeline` plugin for Roda
require 'bundler/inline'
gemfile(true) do
gem 'roda'
gem 'webrick'
end
class M1
def initialize(app)
@app = app