Skip to content

Instantly share code, notes, and snippets.

View georgybu's full-sized avatar
:octocat:
Focusing

Georgy Bunin georgybu

:octocat:
Focusing
View GitHub Profile
@georgybu
georgybu / solution.js
Last active August 21, 2017 17:03
jsninja-BC1-2017-1
function drawNestedSetsTree(data, node) {
if (Array.isArray(data) && node && data.length > 0) {
data.sort((a, b) => a.left - b.left);
let minLeft = 0;
const buildElement = (data, node, parent = null) => {
if (Array.isArray(data)) {
data.forEach((item, index) => {
if ((!parent && index === 0) || (parent && item.left > minLeft && item.left > parent.left && item.right < parent.right)) {
const li = document.createElement('li');
@georgybu
georgybu / unlimited_trials_babeledit.txt
Created December 28, 2019 13:20 — forked from Fusseldieb/unlimited_trials_babeledit.txt
Activate BabelEdit temporarily / Unlimited trial
Obviously for educative purposes only.
Furthermore, this DOESN'T activate BabelEdit permanently.
If you like the software, buy it, the devs deserve it.
Since I have no money to buy it, I discovered a workaround for unlimited trials.
It's quite a annoying workaround, but ... it works!
Firstly go to "c:\windows\system32\drivers\etc\" and open the "hosts" file in Notepad/Notepad++/VSCode/Sublime/Atom/whatever as admin (if you don't open it as admin, it won't let you save it).
Add this line at the end of the file:
@georgybu
georgybu / unlimited_trials_babeledit.txt
Created December 28, 2019 13:20 — forked from Fusseldieb/unlimited_trials_babeledit.txt
Activate BabelEdit temporarily / Unlimited trial
Obviously for educative purposes only.
Furthermore, this DOESN'T activate BabelEdit permanently.
If you like the software, buy it, the devs deserve it.
Since I have no money to buy it, I discovered a workaround for unlimited trials.
It's quite a annoying workaround, but ... it works!
Firstly go to "c:\windows\system32\drivers\etc\" and open the "hosts" file in Notepad/Notepad++/VSCode/Sublime/Atom/whatever as admin (if you don't open it as admin, it won't let you save it).
Add this line at the end of the file:
@georgybu
georgybu / source.js
Created April 5, 2020 13:59 — forked from limitedeternity/source.js
Decrypt m3u8 files from play.boomstream.com/player.html
// FileSaver.min.js
(function(a,b){if("function"==typeof define&&define.amd)define([],b);else if("undefined"!=typeof exports)b();else{b(),a.FileSaver={exports:{}}.exports}})(this,function(){"use strict";function b(a,b){return"undefined"==typeof b?b={autoBom:!1}:"object"!=typeof b&&(console.warn("Depricated: Expected third argument to be a object"),b={autoBom:!b}),b.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function c(b,c,d){var e=new XMLHttpRequest;e.open("GET",b),e.responseType="blob",e.onload=function(){a(e.response,c,d)},e.onerror=function(){console.error("could not download file")},e.send()}function d(a){var b=new XMLHttpRequest;return b.open("HEAD",a,!1),b.send(),200<=b.status&&299>=b.status}function e(a){try{a.dispatchEvent(new MouseEvent("click"))}catch(c){var b=document.createEvent("MouseEvents");b.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(b)}}var f="object"==typeof
@georgybu
georgybu / es6.js
Created October 14, 2022 21:04 — forked from green3g/es6.js
codemod for replacing commonjs with es6 import/export
const requireRegex = new RegExp(/(?:var|let|const)?\s*([^\s]+)?(\s*=\s*)?require\s*\(['"](.+)['"]\)[;,]?/, 'g');
const importReplace = "import $1 from '$3';";
const exportsRegex = new RegExp(/module.exports\s*=\s*/, 'g');
const exportReplace = "export default ";
const importMissingVariable = new RegExp(/import\s*from\s*'/, 'g');
const replaceMissingVariable = "import '";