Skip to content

Instantly share code, notes, and snippets.

View Konstantin6487's full-sized avatar

Konstantin Bochinin Konstantin6487

View GitHub Profile
@Konstantin6487
Konstantin6487 / closures.rb
Created July 31, 2021 14:49 — forked from iansheridan/closures.rb
A demonstration of Ruby closures by Paul Cantrell
# CLOSURES IN RUBY Paul Cantrell http://innig.net
# Email: username "cantrell", domain name "pobox.com"
# I recommend executing this file, then reading it alongside its output.
#
# Alteratively, you can give yourself a sort of Ruby test by deleting all the comments,
# then trying to guess the output of the code!
# A closure is a block of code which meets three criteria:
#
@Konstantin6487
Konstantin6487 / static-dynamic-scope.pl
Created July 11, 2020 15:39 — forked from DmitrySoshnikov/static-dynamic-scope.pl
Static and dynamic scope in Perl
# Lexical and dynamic scopes in Perl;
# Static (lexical) scope uses model of
# environments with frames; dynamic scope
# uses single global var frame.
$a = 0;
sub foo {
return $a;
}
sub staticScope {
@Konstantin6487
Konstantin6487 / async-defer-module.md
Created March 3, 2020 11:11 — forked from jakub-g/async-defer-module.md
async scripts, defer scripts, module scripts: explainer, comparison, and gotchas

<script> async, defer, async defer, module, nomodule, src, inline - the cheat sheet

With the addition of ES modules, there's now no fewer than 24 ways to load your JS code: (inline|not inline) x (defer|no defer) x (async|no async) x (type=text/javascript | type=module | nomodule) -- and each of them is subtly different.

This document is a comparison of various ways the <script> tags in HTML are processed depending on the attributes set.

If you ever wondered when to use inline <script async type="module"> and when <script nomodule defer src="...">, you're in the good place!

Note that this article is about <script>s inserted in the HTML; the behavior of <script>s inserted at runtime is slightly different - see Deep dive into the murky waters of script loading by Jake Archibald (2013)

@Konstantin6487
Konstantin6487 / tmux-cheats.md
Created August 23, 2019 14:41 — forked from Starefossen/tmux-cheats.md
My personal tmux cheat sheet for working with sessions, windows, and panes. `NB` I have remapped the command prefix to `ctrl` + `a`.

Sessions

New Session

  • tmux new [-s name] [cmd] (:new) - new session

Switch Session

  • tmux ls (:ls) - list sessions
  • tmux switch [-t name] (:switch) - switches to an existing session
@Konstantin6487
Konstantin6487 / tslint.json
Created September 18, 2018 07:56 — forked from piotrwitek/tslint.json
TSLint rules with ESLint/React extension based on airbnb style guide
{
"rules": {
"align": [
true,
"parameters",
"arguments",
"statements"
],
"ban": false,
"class-name": true,

ESLint + TSLint + TypeScript + Create React App TS

.eslintrc

{
  "extends": [
    "airbnb",
    "prettier",
    "prettier/react",
@Konstantin6487
Konstantin6487 / composition_vs_chain.js
Created April 17, 2017 05:46 — forked from jurStv/composition_vs_chain.js
From Functional Programming in Javascript book
/*
Here are five different implementations of the same floorSqrt()
functional composition.
They seem to be identical, but they deserve scrutiny.
But there are a few key differences we should go over:
Obviously the first method is verbose and inefficient.
The second method is a nice one-liner, but this approach becomes very unreadable
after only a few functions are applied.
The third approach is a chain of array functions, notably the map function. This works
fairly well, but it is not mathematically correct.
@Konstantin6487
Konstantin6487 / evaluate-model.lisp
Created April 2, 2017 06:26 — forked from maksimr/evaluate-model.lisp
Аппликативный и нормальный порядки вычисления
; Аппликативный и нормальный порядки вычисления
;
; «полная подстановка, затем редукция» известен под на-
; званием нормальный порядок вычислений (normal-order evaluation)
;
; Пример работы нормального порядка вычисления
; Последовательность подстановок
; (sum-of-squares (+ 5 1) (* 5 2))
; (+ (square (+ 5 1)) (square (* 5 2))
; (+ (* (+ 5 1) (+ 5 1)) (* (* 5 2) (* 5 2)))