Skip to content

Instantly share code, notes, and snippets.

View bsa7's full-sized avatar

Belevskij Sergeij bsa7

View GitHub Profile
@bsa7
bsa7 / midnight commander cheatsheet.md
Last active December 10, 2023 14:36
midnight commander cheatseet

Navigational and basic hot keys

Notes:

CTRL-X + D - compare directories or files;

TAB or Ctrl-U is switching focus between left and right panel;

@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 / JSON parser для 1С 7.7
Last active July 10, 2022 18:12
1C 7.7 JSON parser 2.0
Процедура СкриптКонтролИнит(scriptCtrl)
scriptCtrl = СоздатьОбъект("MSScriptControl.ScriptControl");
scriptCtrl.Language="jscript";
код = "
|
| function parseJSON(strJSON) {
| var tmpFunc = (new Function('return('+strJSON+');'))();
| return(tmpFunc);
| }
|
@bsa7
bsa7 / js_jsx_code_conventions.md
Created April 25, 2019 18:42
js and jsx code conventions

Требования к качеству кода javascript

Процесс написания кода сопровождается проверкой кода с помощью ESLint прямо в процессе правки.

Сделайте соответствующие настройки в своей IDE, например для Visual Studio Code вы можете установить плагины:

Обязательные требования:

@bsa7
bsa7 / description.md
Last active September 12, 2021 15:15
React multiselect

React multiselect tag

demo: https://codepen.io

Examples:

simple select with searchable, multiple and creatable:

  <CustomSelect
 items={items}
@bsa7
bsa7 / api_helper.rb
Created February 20, 2019 05:25
redis namespaced wrapper for rails
module Api
module V2
module ApiHelper
## Общий метод генерации ключей для кэша redis
def self.redis_key(params)
params[:locale] = I18n.locale
params_keys = params.keys.map(&:to_s).sort.map(&:to_sym)
['.', params_keys.map { |key| "#{key}:#{params[key]}" }.join('&'), '.'].join
end
end