Skip to content

Instantly share code, notes, and snippets.

View probil's full-sized avatar
:shipit:
Exploring

Max Liashuk probil

:shipit:
Exploring
View GitHub Profile
@probil
probil / importAsToDoToHabitica.js
Last active May 4, 2019 11:04
Habitica: Import as TODO
//
// This scipts allows to import Egghead course as TODO to Habitica
//
// Step 1: Replace `apiKey` and `userId` with yours (check profile settings on Habitica)
// Step 2: Type resource name (egghead/vuemaster/frontendmaster/pluralsight/freecodecamp) in last line of the script
// Step 3: Open desired course in browser
// Step 4: Open DevTool and execute script in console
// Step 5: Check Habitica: new ToDo should be there :)
@probil
probil / is-minified.js
Created December 9, 2021 11:00
A small function to determine minification of the JavaScript file. Borrowed from Chrome DevTools
// https://github.com/ChromeDevTools/devtools-frontend/blob/0dc36933e485a7009c380f41564848d70cafb429/front_end/models/text_utils/TextUtils.ts#L336
export function isMinified(text) {
const kMaxNonMinifiedLength = 500;
let linesToCheck = 10;
let lastPosition = 0;
do {
let eolIndex = text.indexOf('\n', lastPosition);
if (eolIndex < 0) {
eolIndex = text.length;