Skip to content

Instantly share code, notes, and snippets.

View arturparkhisenko's full-sized avatar
:octocat:
www. www always changes

Artur Parkhisenko arturparkhisenko

:octocat:
www. www always changes
View GitHub Profile
@arturparkhisenko
arturparkhisenko / supportsNativeHls.js
Created March 29, 2023 15:02
Whether the browser has built-in HLS support.
// From https://github.com/videojs/http-streaming/blob/d258fae646a3a4a6dc2ba26c729710dd8f39876a/src/videojs-http-streaming.js#L430-L464
/**
* Whether the browser has built-in HLS support.
*/
window._supportsNativeHls = (function() {
if (!document || !document.createElement) {
return false;
}
const video = document.createElement('video');
@arturparkhisenko
arturparkhisenko / detect-chromecast.js
Created February 28, 2022 14:51 — forked from lfalke/detect-chromecast.js
Detect Chromecast Model / Generation in Javascript
/**
* We use this workaround to detect the Chromecast device generation.
* Unfortunately the Cast Application Framework (CAF) does not have an API for that.
*
* cc-1: Chromecast 1st Gen.
* cc-2: Chromecast 2nd Gen.
* cc-3: Chromecast 3rd Gen.
* cc-ultra: Chromecast Ultra
* cc-builtin: Android TV with Chromecast built-in
*/
@arturparkhisenko
arturparkhisenko / esm-package.md
Created October 26, 2021 11:06 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package linked to from here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@arturparkhisenko
arturparkhisenko / fe-vs-be.md
Created October 28, 2020 16:17 — forked from WebReflection/fe-vs-be.md
Front End vs Back End in a nutshell.

FE vs BE

TL;DR enough of this kind of nonsense


I've been in the field for ~20 years and started as BE developer, and this is a reference for people thinking that because they are on the BE side, they're somehow entitled to:

  • earn more money
  • feel superior about FE developers
  • joke about JavaScript or minimize the FE effort in any way
@arturparkhisenko
arturparkhisenko / ds.csv
Created May 26, 2020 23:14 — forked from masrab/ds.csv
Visual data structure selector
Name Indexing (Average) Search (Average) Insertion (Average) Deletion (Worst) Indexing (Worst) Search (Worst) Insertion (Worst) Deletion (Worst) Space
Basic Array O(1) O(n) Undefined Undefined O(1) O(n) Undefined Undefined O(n)
Dynamic Array O(1) O(n) O(n) O(n) O(1) O(n) O(n) O(n) O(n)
Singly-Linked List O(n) O(n) O(1) O(1) O(n) O(n) O(1) O(1) O(n)
Doubly-Linked List O(n) O(n) O(1) O(1) O(n) O(n) O(1) O(1) O(n)
Skip List O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(n) O(n) O(n) O(n) O(n log(n))
Hash Table Undefined O(1) O(1) O(1) Undefined O(n) O(n) O(n) O(n)
Binary Search Tree O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(n) O(n) O(n) O(n) O(n)
Cartresian Tree Undefined O(log(n)) O(log(n)) O(log(n)) Undefined O(n) O(n) O(n) O(n)
B-Tree O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(log(n)) O(n)

FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

@arturparkhisenko
arturparkhisenko / iterm2-solarized.md
Created November 21, 2019 13:49 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@arturparkhisenko
arturparkhisenko / ffmpeg.md
Created October 13, 2019 02:08 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

@arturparkhisenko
arturparkhisenko / fonts-multi-language-support-test-string.js
Created March 18, 2019 18:47
fonts multi-language support test string
// https://pages.ucsd.edu/~dkjordan/chin/unitestuni.html
// https://fonts.google.com/specimen/Noto+Sans
const multiLanguageText = "00:00, : ,Ā Á Ă À ā á ă à Ǖ Ǘ Ǚ Ǜ ǖ ǘ ǚ ǜĈ ĉ Ĝ ĝ Ĥ ĥĴ ĵ Ŝ ŝ Ŭ ŭ Я не говорю по-русски. Я також не розмовляю Українською. Μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος. אני לא לומד עברית 𓂝𓃀𓅡𓄿𓌂 𓋴𓅓𓏏𓇏𓇌𓀀 我们刚才从 图书馆来了。 我們剛才從 圖書館來了。 𦮙, ABCČĆDĐEFGHIJKLMNOPQRSŠTUVWXYZŽ abcčćdđefghijklmnopqrsštuvwxyzž АБВГҐДЂЕЁЄЖЗЅИІЇЙЈКЛЉМНЊОПРСТЋУЎФХЦЧЏШЩЪЫЬЭЮЯ абвгґдђеёєжзѕиіїйјклљмнњопрстћуўфхцчџшщъыьэюя ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ αβγδεζηθικλμνξοπρστυφχψωά ΆέΈέΉίϊΐΊόΌύΰϋΎΫὰάὲέὴήὶίὸόὺύὼώ ΏĂÂÊÔƠƯăâêôơư आईऊऋॠऌॡऐऔऎअं अँकखगघङचछजझञटठडढणतथदधनपफबभयरवळशषसह 1234567890 ०१२३४५६७८९‘?’“!”(%) [#]{@}&<-+÷×=> ®©$€£¥¢:;,.*₹"
@arturparkhisenko
arturparkhisenko / cors.js
Created February 27, 2019 16:19 — forked from balupton/cors.js
Acheiving CORS via a Node HTTP Server
// Create our server
var server;
server = http.createServer(function(req,res){
// Set CORS headers
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Request-Method', '*');
res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET');
res.setHeader('Access-Control-Allow-Headers', '*');
if ( req.method === 'OPTIONS' ) {
res.writeHead(200);