Skip to content

Instantly share code, notes, and snippets.

View bsa7's full-sized avatar

Belevskij Sergeij bsa7

View GitHub Profile
@bsa7
bsa7 / Readme
Last active November 11, 2024 18:22
historyable-attribute
The public gist for https://github.com/bsa7/historyable-attribute
@bsa7
bsa7 / cheatsheet.rb
Created May 27, 2023 07:32 — forked from mabenson00/cheatsheet.rb
Rails ActiveRecord JSON cheatsheet
# Basic key operators to query the JSON objects :
# #> : Get the JSON object at that path (if you need to do something fancy)
# -> : Get the JSON object at that path (if you don't)
# ->> : Get the JSON object at that path as text
# {obj, n} : Get the nth item in that object
# https://www.postgresql.org/docs/9.4/functions-json.html#FUNCTIONS-JSONB-OP-TABLE
# Date
# date before today
@bsa7
bsa7 / RFMSegmentsMap.png
Last active May 11, 2023 15:11
BaSeg - гист для ассетов репозитория
RFMSegmentsMap.png
This public gist will be used as badges storage for https://github.com/bsa7/SimpleMLPipeline
@bsa7
bsa7 / Integral.py
Last active March 1, 2023 18:36
Local and integral Laplace theorems.
import math
import numpy as np
# P(k1, k2) = F(x'') - F(x')
# where x', x'' - first and second derivatives from x
# xs = (k1 - np) / (n * p * q) ** 0.5
# xss = (k2 - np) / (n * p * q) ** 0.5
# F(x) = (1 / (2 * PI) ** 0.5) * integral(0, x) e ** -(z**2 / 2) dz
def P(n, p, k1, k2):
@bsa7
bsa7 / helpers_methods.rb
Created August 15, 2022 16:44
Check intersections in method names of Rails helpers
# frozen_string_literal: true
# You would to run `HelpersMethods.new.call` as Rails class from rails console
class HelpersMethods
def call
helper_files = Dir.glob(Rails.root.join('app/helpers/**/*.rb'))
helpers_methods = {}
intersections = {}
helper_files.each do |file_name|
@bsa7
bsa7 / help.md
Last active April 11, 2020 04:43
webpack-cli 3 help
npx webpack -h
webpack-cli 3.3.11

Usage: webpack-cli [options]
       webpack-cli [options] --entry <entry> --output <output>
 webpack-cli [options]  --output 
@bsa7
bsa7 / help.md
Created April 11, 2020 04:43
webpack-cli 3 help

npx webpack -h webpack-cli 3.3.11

Usage: webpack-cli [options] webpack-cli [options] --entry --output webpack-cli [options] <entries...> --output webpack-cli [options]

For more information, see https://webpack.js.org/api/cli/.

@bsa7
bsa7 / readme.md
Last active April 8, 2020 09:20
href elements terminology
/**
 * location terminology: https://xxxxx.ru/users/:userId/news/:newsId?param1=value1&param2=value2#param3=value3
 * protocol              ^^^^^
 * domain                        ^^^^^^^^
 * hostname              ^^^^^^^^^^^^^^^^
 * pathname                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 * pathnameParams: { userId: xxx, newsId: yyy }
 * search                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 * searchParams: { param1: value1, param2: value2 }
2019/06/04 05:21:50 [debug] 1239#1239: accept on 0.0.0.0:443, ready: 0
2019/06/04 05:21:50 [debug] 1239#1239: posix_memalign: 000055BBAC706B50:512 @16
2019/06/04 05:21:50 [debug] 1239#1239: *130 accept: 85.15.188.96:63602 fd:20
2019/06/04 05:21:50 [debug] 1239#1239: *130 event timer add: 20: 60000:887463
2019/06/04 05:21:50 [debug] 1239#1239: *130 reusable connection: 1
2019/06/04 05:21:50 [debug] 1239#1239: *130 epoll add event: fd:20 op:1 ev:80002001
2019/06/04 05:21:50 [debug] 1239#1239: *130 http check ssl handshake
2019/06/04 05:21:50 [debug] 1239#1239: *130 http recv(): 1
2019/06/04 05:21:50 [debug] 1239#1239: *130 https ssl handshake: 0x16
2019/06/04 05:21:50 [debug] 1239#1239: *130 tcp_nodelay