Skip to content

Instantly share code, notes, and snippets.

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
@v-kolesnikov
v-kolesnikov / http_streaming.md
Created May 30, 2019 17:08 — forked from CMCDragonkai/http_streaming.md
HTTP Streaming (or Chunked vs Store & Forward)
View http_streaming.md

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@v-kolesnikov
v-kolesnikov / coverage.rb
Created January 29, 2023 11:34
Coverage groups
View coverage.rb
# 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}
View .npmrc
audit=false
engine-strict=true
fund=false
legacy-peer-deps=false
View bookmate-tech-stack.md

Bookmate Tech Stack

Backend

Primary technologies

  • Ruby
  • Ruby on Rails (v.6 at 12/22)
  • Sidekiq
  • MySQL
View Fast SQL counting for UI
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 .
@v-kolesnikov
v-kolesnikov / app.rb
Created May 23, 2020 09:08
Single file Rails app
View app.rb
# frozen_string_literal: true
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'rails', '~> 6.0'
end
require 'action_controller/railtie'
@v-kolesnikov
v-kolesnikov / Gemfile
Last active August 22, 2022 18:45
Asynchronous files downloader.
View Gemfile
# frozen_string_literal: true
source "https://rubygems.org"
gem 'down'
gem 'dry-monads'
gem 'http'
@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
View hugofastsearch.md

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
View ll.rb
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
View roda_pipeline.rb
require 'bundler/inline'
gemfile(true) do
gem 'roda'
gem 'webrick'
end
class M1
def initialize(app)
@app = app