Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I maintain OSS projects at nights, am available GMT+3 from 9pm to 1am

Alex Berezin Beraliv

💭
I maintain OSS projects at nights, am available GMT+3 from 9pm to 1am
View GitHub Profile
@Beraliv
Beraliv / simplified-playback-source-fetcher.min.js
Last active May 4, 2020
Simplified minified and deobfuscated Joyn playback source fetcher
View simplified-playback-source-fetcher.min.js
/*! @vod/playback-source-fetcher 0.0.72 17-04-2020 13:44:58 */
(function (modules) {
var installedModules = {};
function __webpack_require__(moduleId) {
if (installedModules[moduleId]) {
return installedModules[moduleId]["exports"];
}
var module = (installedModules[moduleId] = {
i: moduleId,
@Beraliv
Beraliv / recursive_to_iterative.ts
Last active Jan 29, 2020
Recursive to iterative algorithm change
View recursive_to_iterative.ts
export const decompose = (n: number) => {
const decomposeWithIndex = (rest: number, index: number, currentResult = []) => {
var repeat = true;
var saved = [];
while (repeat) {
repeat = false;
if (index < 0) {
@Beraliv
Beraliv / recursive_squares.ts
Created Jan 29, 2020
Recursive solution to a task
View recursive_squares.ts
export class G964 {
public static decompose = (n: number) => {
const decomposeWithIndex = (rest: number, index: number, currentResult = []) => {
if (index < 0) {
return null;
}
if (index * index > rest) {
return decomposeWithIndex(rest, index - 1, currentResult);
}
@Beraliv
Beraliv / iterative_squares.ts
Created Jan 29, 2020
Iterative solution to a task
View iterative_squares.ts
export class G964 {
public static decompose = (n: number) => {
const decomposeWithIndex = (rest: number, index: number, currentResult = []) => {
var repeat = true;
var saved = [];
while (repeat) {
repeat = false;
@Beraliv
Beraliv / async_event_example.json
Created Jan 7, 2020
Async example of events for Udemy
View async_event_example.json
[
{
"mapve": "2.0",
"memve": "2.7.0",
"ualnm": "Chrome",
"ualve": "79.0.3945.88",
"ualeg": "Blink",
"udvnm": null,
"udvcg": "",
"udvmn": null,
@Beraliv
Beraliv / sync_event_example.json
Last active Jan 7, 2020
Sync example of events for Udemy
View sync_event_example.json
[
{
"mapve": "2.0",
"bdm": "litix.io",
"psqno": 26,
"xsqno": 26,
"pispa": false,
"pphti": 1339532,
"uti": 1578401570429,
"ake": "vfq2nsli1v76fglgdl9puq0cd",
View vendor-videojs.js
(window.webpackJsonp = window.webpackJsonp || []).push([["vendor-videojs"], {
"./node_modules/video.js/dist/video.cjs.js": function(e, t, r) {
function n(e) {
return e && "object" == typeof e && "default"in e ? e.default : e
}
var i, o, a, s, p = n(r("./node_modules/global/window.js")), f = n(r("./node_modules/global/document.js")), d = n(r("./node_modules/tsml/tsml.js")), v = n(r("./node_modules/safe-json-parse/tuple.js")), y = n(r("./node_modules/xhr/index.js")), l = n(r("./node_modules/videojs-vtt.js/lib/browser-index.js")), m = "6.12.1", u = p.navigator && p.navigator.userAgent || "", c = /AppleWebKit\/([\d.]+)/i.exec(u), h = c ? parseFloat(c.pop()) : null, _ = /iPad/i.test(u), g = /iPhone/i.test(u) && !_, b = /iPod/i.test(u), T = g || _ || b, w = (i = u.match(/OS (\d+)_/i)) && i[1] ? i[1] : null, k = /Android/i.test(u), S = function() {
var e = u.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
if (!e)
return null;
@Beraliv
Beraliv / tvip-script-app-store.js
Created Dec 21, 2019
BBC iPlayer initial redux state
View tvip-script-app-store.js
window.__IPLAYER_REDUX_STATE__ = {
"translations": {
"page_title_version_ad": "Audio Described",
"page_title_version_sign": "Signed",
"related_episodes_this_episode_label": "This episode",
"related_episodes_title": "More episodes",
"related_episodes_view_all": "View all",
"msi_modal_title": "You need to sign in. It's quick & easy.",
"msi_modal_text": "And we'll keep you signed in.",
"msi_modal_why_sign_in": "Why sign in to the BBC?",
@Beraliv
Beraliv / bbcuser.js
Last active Jul 21, 2020
BBC User API in html on bbc.co.uk
View bbcuser.js
var USERINFO_URL = "";
var USERINFO_PREFIX = "www." || "www.";
function initUserCache(orbitUser) {
var availableAttr = [
'X-Country',
'X-Ip_is_advertise_combined',
'X-Ip_is_uk_combined'
];
var userCache = availableAttr.reduce(function(user, curr, i) {
@Beraliv
Beraliv / all-permutations.js
Created Nov 3, 2019
Find all permutations for a specified string
View all-permutations.js
/**
* Traverse permutation to add new letter to every new position
*
* @example
* generateNextPermutation(['a','b'],'c')
* // => [['c','a','b'],['a','c','b'],['a','b','c']]
*/
function generateNextPermutation(permutation, ch) {
const destination = [];
for (let i = 0; i <= permutation.length; i++) {