Skip to content

Instantly share code, notes, and snippets.

Avatar

Ivan Kleshnin ivan-kleshnin

View GitHub Profile
@tkrotoff
tkrotoff / FrontendFrameworksPopularity.md
Last active Jul 26, 2021
Front-end frameworks popularity (React, Vue and Angular)
View FrontendFrameworksPopularity.md

Findings: React is by far the most popular front-end framework/library (and continues to grow faster), except for the GitHub stars. In addition, React is more loved and "wanted" than other front-end frameworks (although it is more used: satisfaction tends to decrease with popularity).

Charts are from different sources and thus colors are inconsistent, please carefully read the chart's legends.

Stack Overflow trends

https://insights.stackoverflow.com/trends?tags=reactjs%2Cvue.js%2Cangular%2Cangularjs

insights.stackoverflow.com

View oop.txt
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
@kharandziuk
kharandziuk / article.md
Last active Mar 2, 2021
Node.js Streams and Reactive Programming Primer
View article.md

This article shows how to apply Node.js Stream and a bit of Reactive programming to a real(tm) problem. The article is intended to be highly practical and oriented for an intermediate reader. I intentionally omit some basic explanations. If you miss something try to check the API documentation or its retelling(e.g.: this one)

So, lets start from the problem description. We need to implement a simple web scraper which grabs all the data from some REST API, process the data somehow and inserts into our Database. For simplicity, I omit the details about the actual database and REST API(in real life it was the API of some travel fare aggregator website and a Pg database)

Consider we have two functions(code of the IO simulator functions and the other article code is here):

getAPI(n, count) // pseudo API ca
View shims.md

Map

JS Map can be usable once you augment it.

Map.prototype.map = function (fn) {
  let m2 = new Map()
  for (let [k, v] of this) {
    m2.set(k, fn(v, k))
  }
@fulv
fulv / main.yml
Last active May 20, 2021
Ansible - Creating users and copying ssh keypair files to the remote server
View main.yml
Put this in your `local-configure.yml` file, add as many users as you need:
users:
- name: fulvio
sudoer: yes
auth_key: ssh-rsa blahblahblahsomekey this is actually the public key in cleartext
- name: plone_buildout
group: plone_group
sudoer: no
auth_key: ssh-rsa blahblahblah ansible-generated on default
@staltz
staltz / first.js
Created Dec 10, 2015
Tiny Cycle.js 0
View first.js
Rx.Observable.timer(0, 1000)
.map(i => `Seconds elapsed ${i}`)
.subscribe(text => {
const container = document.querySelector('#app');
container.textContent = text;
});
View tiny-cycle-2.js
function main() {
return {
DOM: Rx.Observable.timer(0, 1000)
.map(i => {
return {
tagName: 'h1',
children: [`Seconds elapsed ${i}`]
}
})
}
View tiny-cycle-1.js
function main() {
return {
DOM: Rx.Observable.timer(0, 1000)
.map(i => `Seconds elapsed ${i}`)
};
}
const drivers = {
DOM: function DOMDriver(sink) {
sink.subscribe(text => {
@staltz
staltz / slim-cycle-core.js
Created Sep 22, 2015
Cycle.js without sanity checks and comments in a single file. Don't use this, use normal Cycle.js. :-)
View slim-cycle-core.js
let Rx = require(`rx`)
function makeRequestProxies(drivers) {
let requestProxies = {}
for (let name in drivers) {
if (drivers.hasOwnProperty(name)) {
requestProxies[name] = new Rx.ReplaySubject(1)
}
}
return requestProxies
@shaunlebron
shaunlebron / es7coreasync.md
Last active Jul 28, 2018
es7 vs core.async
View es7coreasync.md

Comparing ES7 and core.async

ES7 core.async
async function() {...} (fn [] (go ...))
await ... (<! ...)
await* or Promise.all(...) (doseq [c ...] (<! c))