Skip to content

Instantly share code, notes, and snippets.

View OleksiyRudenko's full-sized avatar
💻
Delivering

Oleksiy Rudenko OleksiyRudenko

💻
Delivering
View GitHub Profile
@OleksiyRudenko
OleksiyRudenko / Promise-chaining.md
Created October 22, 2022 21:00
Promises chaining
    anArray
        .filter(x => x % 2) // odd only
        .reduce(
            (chain, x) => chain.then(() => networkCall(x)), // network call using an odd
            Promise.resolve()
        )
        .then(() => console.log('all done')) // all calls complete

BAAS

BAAS cloud hosting NodeJS lambdas Auth RDBMS NoSQL CLI
[Supabase][_sb]
[Conduit][_cd]
[Acebase][_ab]
[Vercel][_vc]
[x][_]
@OleksiyRudenko
OleksiyRudenko / PAT for workflows.md
Last active July 27, 2022 16:14
Re-issue IDE OAuth token that allows to push GitHub workflows

IDE

(See recipe for Windows below)

I've literally just come across this problem when trying to use IntelliJ to push to a branch that contains a GitHub Action workflow (YAML file in .github/workflows). I didn't find existing resources on the Internet very helpful, so I hope this will help you fix it too.

TL;DR: Generate a new Personal Access Token with the workflow scope enabled in GitHub and configure your application to use that.

Promise patterns

Promises chaining

anArray
  .reduce(
    (chain, x) => chain.then(() => networkCall(x)),
    Promise.resolve()
 )

Images

Lazy loading

<img src="image.png" loading="lazy" alt="…" width="200" height="200">

Adaptive image set

<picture>
  <source media="(min-width:768px)" srcset="med_flag.jpg">
  <source media="(min-width:495px)" srcset="small_flower.jpg">
  <img src="high_flag.jpg" alt="Flags" style="width:auto;">
@OleksiyRudenko
OleksiyRudenko / install-py.md
Last active August 10, 2020 17:12
Python for JS dev
@OleksiyRudenko
OleksiyRudenko / latency.md
Last active July 6, 2020 13:44 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know

Latency Comparison Numbers (~2012)

L1 cache reference                           0.5 ns
Branch mispredict                            5   ns
L2 cache reference                           7   ns                      14x L1 cache
Mutex lock/unlock                           25   ns
Main memory reference                      100   ns                      20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy             3,000   ns        3 us
Send 1K bytes over 1 Gbps network       10,000   ns       10 us
/*
I came up with a single pass O(n) sort algorithm I call StalinSort.
You iterate down the list of elements checking if they're in order.
Any element which is out of order is eliminated.
At the end you have a sorted list.
© 2018-10-25, @mathew@mastodon.social
*/
const stalinSortReduce = arr => arr.reduce((acc,v) => acc.length ? acc[acc.length-1] < v ? [...acc, v] : acc : [v], [])