Skip to content

Instantly share code, notes, and snippets.

const offset = new Date().getTimezoneOffset();
function getDigit(s, p) {
return s.charCodeAt(p) - 48;
}
function parseISOString(d) {
return new Date(
getDigit(d, 0) * 1000 + getDigit(d, 1) * 100 + getDigit(d, 2) * 10 + getDigit(d, 3),
getDigit(d, 5) * 10 + getDigit(d, 6) - 1,
getDigit(d, 8) * 10 + getDigit(d, 9),
getDigit(d, 11) * 10 + getDigit(d, 12),
@cevek
cevek / fast-switch.js
Created October 1, 2020 17:18
Fast binary switch
function id8(p) {
if (p > 3) {
if (p > 5) {
if (p === 6) {
return 6;
} else {
return 7;
}
} else {
search
abort
blur
change
click
close
contextmenu
dblclick
drag
dragend
@cevek
cevek / code.js
Last active September 2, 2022 11:31
youtube storyboards
(function showStoryboard() {
var template = ytplayer.config.args.raw_player_response.storyboards.playerStoryboardSpecRenderer.spec;
function getStoryboardImages(template) {
var [url, _, _, layer] = template.split('|');
var [w, h, count, cols, rows, _, _, sig] = layer.split('#');
var countPerImage = cols * rows;
var imgCount = Math.ceil(count / countPerImage);
return Array(imgCount)
.fill(0)