This file contains 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 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 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 has been truncated, but you can view the full file.
This file contains 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
{ | |
"log": { | |
"version": "1.2", | |
"creator": { | |
"name": "WebInspector", | |
"version": "537.36" | |
}, | |
"pages": [], | |
"entries": [ | |
{ |
This file contains 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
/* | |
* jsk.c | |
* | |
* Copyright (C) 2013, Frederic Kayser. | |
* | |
*/ | |
#include <stdio.h> | |
#include <stddef.h> |
This file contains 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 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 rafThrottler(callback) { | |
let rafId = null; | |
const flush = () => { | |
callback(); | |
rafId = null; | |
}; | |
return () => { | |
if (rafId) { | |
return; |
This file contains 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
const vscode = require('vscode'); | |
const path = require('path'); | |
// puppeteer is great because it's easy to use, but it comes with 30MB headless Chrome that | |
// we can't use as it doesn't have `Profiler.startTypeProfile` yet. We have to point to a | |
// locally installed Chrome Canary instead. It's fine for a POC, but puppeteer isn't probably | |
// a good fit in a long run. | |
const puppeteer = require('puppeteer'); | |
const PATH_TO_CANARY = '/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary'; |
This file contains 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(){ | |
let gamepad = null; | |
let loopInterval = null; | |
window.addEventListener("gamepadconnected", connectHandler); | |
window.addEventListener("gamepaddisconnected", disconnectHandler); | |
function connectHandler(e) { | |
if (!gamepad) { |
This file contains 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
const commonNodes = [ | |
'div', 'span', 'p', | |
'b', 'i', 'u', 'strong', 'em', | |
'h2', 'h3', | |
]; | |
/** | |
* @param {Array<string>} attributes | |
* @returns {Map<string, string>} | |
*/ |