Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Delivering Kottans course

Oleksiy Rudenko OleksiyRudenko

:octocat:
Delivering Kottans course
View GitHub Profile
@OleksiyRudenko
OleksiyRudenko / install-py.md
Last active Aug 10, 2020
Python for JS dev
View install-py.md
@OleksiyRudenko
OleksiyRudenko / latency.md
Last active Jul 6, 2020 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
View latency.md

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
View stalinSort.js
/*
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], [])
@OleksiyRudenko
OleksiyRudenko / tips-n-tricks.md
Last active Apr 10, 2020
GitHub tips and tricks
View tips-n-tricks.md

Fuzzy file finder

On any repo press t to start fuzzy file finder

Code snippet:

  • Open a file
  • Select a code line
  • SHIFT+LeftClick to select multiple
  • RightClick for context menu + Copy permalink or press y It renders nicely when in an issue comment
@OleksiyRudenko
OleksiyRudenko / count-entries-in-an-array.md
Last active Jan 8, 2020
Counting entries in an array
View count-entries-in-an-array.md

Classics:

Count number of each entry in an array. I.e. someFunc(['a', 'b', 5, 'a', 2, 5]) should result in

{
  2: 1,
  5: 2,
  'a': 2,
  'b': 1
@OleksiyRudenko
OleksiyRudenko / instructions.rst
Created Jan 5, 2020 — forked from Nachtalb/telegram-desktop-multiple-accounts.rst
Add multiple accounts in Telegram Desktop [Linux | MacOSX | Windows]
View instructions.rst

How to add multiple accounts to Telegram Desktop

Table of Contents

Introduction

ATM of writing this, there is no way inside the Telegram Client to switch accounts (event though this feature exists in the offical mobile clients and there is a long running issue here: telegramdesktop/tdesktop#4261).

@OleksiyRudenko
OleksiyRudenko / why-newline.md
Last active Nov 20, 2019
Why should text files end with a newline?
View why-newline.md

Why should text files end with a newline?

Reasons:

  • UNIX standard
  • If the last line in a file doesn't end with a newline then addition of next line affects two lines instead of one. This also pollutes diff on multiple files, so reader may wonder what has changed in a line whereas no significant change has occured.

Multiple newlines at the file end are also redundant as well as spaces at the end of line.

View Unintended-submodule-issue.md

WORK IN PROGRESS

Unintended submodule issue

One of the problems developers new to git may face is a mysterious sub-modules they didn't expect to have.

illustration

How this happens?

View css-layout-hack.js
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var domStyle = document.createElement("style");
domStyle.append(
'* { color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }\
* * { background-color: rgba(0,255,0,.2) !important; }\
* * * { background-color: rgba(0,0,255,.2) !important; }\
* * * * { background-color: rgba(255,0,255,.2) !important; }\
* * * * * { background-color: rgba(0,255,255,.2) !important; }\
View template.md

[MIT Licensed][license] [![Kottans-Frontend][icon-kottans-fe]][kottans-frontend] [![Kottans-Backend][icon-kottans-be]][kottans-backend] [![Kottans-CS][icon-kottans-cs]][kottans-cs]

....

At the file end (open source to view)

You can’t perform that action at this time.