❤️🔥
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mov-to-gif() { | |
ffmpeg -i $1 -vf "scale=1024:-1:flags=lanczos" -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=0 --delay=7 # | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
palette="./palette.png" | |
# speed - setpts=0.15*PTS, | |
# crop - ffmpeg -i in.mov -filter:v "crop=480:600:320:80" out.mov | |
filters="fps=25,scale=640:-1:flags=lanczos" | |
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This script attempts to identify all CSS classes mentioned in HTML but not defined in the stylesheets. | |
In order to use it, just run it in the DevTools console (or add it to DevTools Snippets and run it from there). | |
Note that this script requires browser to support `fetch` and some ES6 features (fat arrow, Promises, Array.from, Set). You can transpile it to ES5 here: https://babeljs.io/repl/ . | |
Known limitations: | |
- it won't be able to take into account some external stylesheets (if CORS isn't set up) | |
- it will produce false negatives for classes that are mentioned in the comments. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1) fetch members of polish parlament (poslowie) | |
// 2) group them by occupation | |
// 3) sort occupations by number of members and occupation name | |
// 4) get top 5 entries | |
// 5) print result on the screen | |
(function() { | |
'use strict'; | |
const POSLOWIE_ENDPOINT = 'https://api-v3.mojepanstwo.pl/dane/poslowie/'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getFamilyTree(el) { | |
const levels = new Map(); | |
function bfs(el, level) { | |
const levelElements = levels.get(level) || []; | |
for (const child of el.children) { | |
child.style.opacity = '0'; | |
levelElements.push(child); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
function hideEvertyhingAround($el) { | |
const $parent = $el.parentElement; | |
$parent.style.transition = 'background-color 150ms ease-in'; | |
$parent.style.backgroundColor = 'white'; | |
$parent.childNodes.forEach($child => { | |
if($child !== $el && $child.style) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rafId; | |
function scrollToElement(el, offsetTop = 0) { | |
scrollByValue(el.getBoundingClientRect().top - offsetTop); | |
} | |
function scrollByValue(offsetTop = 0) { | |
if (offsetTop !== 0) { | |
if (rafId) { | |
cancelAnimationFrame(rafId); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getScript(url, success = () => {}, async = true, defer = false, attributes) { | |
var debugMode = debugMode || Boolean(window.console && console && ( | |
Boolean(window.location.href.indexOf('localhost')+1) || | |
Boolean(window.location.href.indexOf('dev.')+1) | |
)), | |
script = document.createElement('script'), | |
deferLoadFunc = function() { | |
script.src = url; | |
script.type = 'text/javascript'; | |
if (async) script.async = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Designed to solve this LeetCode problem: https://leetcode.com/problems/basic-calculator-iv/ | |
// Author: Crates McD (https://cr8s.net) | |
// Runtime: 60 ms, faster than 100.00% of JavaScript online submissions for Basic Calculator IV | |
// Memory Usage: 36.3 MB, less than 100.00% of JavaScript online submissions for Basic Calculator IV | |
class Term { | |
constructor (coefficient, variables = [], degree = 0) { | |
this.variables = variables; | |
this.coefficient = coefficient; | |
this.degree = degree; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Designed to solve this LeetCode problem: https://leetcode.com/problems/cut-off-trees-for-golf-event/ | |
// Author: Crates McD (https://cr8s.net) | |
// Runtime: 3912 ms, faster than 18.95% of JavaScript online submissions for Cut Off Trees for Golf Event. | |
// Memory Usage: 51.8 MB, less than 100.00% of JavaScript online submissions for Cut Off Trees for Golf Event. | |
/** | |
* @param {number[][]} forest | |
* @return {number} | |
*/ | |
const cutOffTree = (forest) => { |