Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View ivan-kleshnin's full-sized avatar
🏠
Working from home

Ivan Kleshnin ivan-kleshnin

🏠
Working from home
View GitHub Profile
@ivan-kleshnin
ivan-kleshnin / design-for-non-designers.md
Last active May 20, 2019 08:59
Design resources for non-designers
function swap(i1, i2, xs) {
if (i1 == i2) return xs
return xs.reduce((z, x, i) => {
return i == i1 ? z :
i == i2 ? (i1 > i2 ? [...z, xs[i1], x] : [...z, x, xs[i1]]) :
[...z, x]
}, [])
}
// Например, переставить 'B' с i1 = 1 на i2 = 4

A tale of SSR

Attempts to recover our SSR functionality.

  1. After.js [-]
  • Semi-dead project. Suggest to switch to Razzle (its core)
  1. Razzle [-]
Object Oriented Programming
I Objects / Classes are main units of design
II Objects are namespaces (expression problem, duality with Functional Programming)
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
III Delegation / Inheritance (type dependency)
IV Constructors (vs data constructors)
V Mutability (shared state)
VI Fluent API (http://paqmind.com/blog/fluent-api-debunked/)
VII Instance
@ivan-kleshnin
ivan-kleshnin / reactive-middleware-stack-proto.js
Last active October 26, 2017 10:24
Reactive middleware stack prototype
import * as R from "ramda"
let Atom = R.curry((options, actions) => {
console.log(`@ Atom "${options.name || ""}" is called`)
return {$: "$"}
})
let withLog = R.curry((options, Atom) => {
return (actions) => {
console.log(`@ Shell "withLog" is called`)
@ivan-kleshnin
ivan-kleshnin / flattenObj.md
Last active October 9, 2017 14:37
flattenObject

My code from: https://gist.github.com/penguinboy/762197

let isPlainObj = (o) => Object.prototype.toString.call(o) == "[object Object]"
// this ^ is enough. If you check prototypes – you're doing it wrong. If somethings pretends to be plain – we have to accept that
// e.g. this: https://github.com/jonschlinkert/is-plain-object is an entirely WRONG approach 

let flattenObj = (obj, keys=[]) => {
  return Object.keys(obj).reduce((acc, key) => {
    return Object.assign(acc, isPlainObj(obj[key])
@ivan-kleshnin
ivan-kleshnin / idris-first-impression.md
Last active August 14, 2017 10:23
Idris: first impression

Idris: first impression

Language

Likes

Dependent types

The idea and approach is brilliant. I hope it's the next big thing in programming.

@ivan-kleshnin
ivan-kleshnin / pascal's-triangle.js
Last active February 19, 2017 20:42
SICP exercise 1.12
/*
Pascal's Triangle
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
The numbers at the edge of the triangle are all 1, and each number inside the triangle is the sum of
the two numbers above it. Write a procedure that computes elements of Pascal's triangle by means of
Parallel – 2+ processes (or cores)
Concurrent – whatever
Parallel is for increasing throughput
Concurrent is for decreasing latency
Parallel is for non-interactive (performance) (few inputs, deterministic or non-deterministic)
Concurrent is for interactive (experience) (many inputs, non-deterministic)
Parallel – how fast it gets result