Skip to content

Instantly share code, notes, and snippets.

View ViliamKopecky's full-sized avatar
🤡
clowning

Viliam Kopecký ViliamKopecky

🤡
clowning
View GitHub Profile
@ViliamKopecky
ViliamKopecky / find-used-fonts.js
Created November 2, 2021 10:17
Find all used font-families and their font-weights on a page
(() => {
const data = {};
document.querySelectorAll("*").forEach((el) => {
const style = window.getComputedStyle(el);
const font = String(style.fontFamily).split(",").shift().replace(/\"/g, '');
data[font] = data[font] ?? {};
data[font][style.fontWeight] = data[font][style.fontWeight] ?? 0;
data[font][style.fontWeight]++;
});
console.log(JSON.stringify(data, null, 2));
@ViliamKopecky
ViliamKopecky / SketchSystems.spec
Created February 28, 2019 12:58
My Awesome Sketch
My Awesome Sketch
First State
some event -> Trololo
Trololo
@ViliamKopecky
ViliamKopecky / Memoize.php
Last active June 12, 2018 08:21
PHP cached calling functions proxy
<?php
/*
# Usage
# just prefix old function call with `Memoize::`
someFunction("foo", 123);
Memoize::someFunction("foo", 123);
@ViliamKopecky
ViliamKopecky / overscrolls.sass
Created June 6, 2018 07:33
Custom overscroll colors for top and bottom sides of a page
=overscrolls($topColor, $bottomColor, $darken: 10%)
@if $topColor
body::before
content: ''
position: fixed
right: 0
left: 0
z-index: -1
<?php
function templateString($subject, array $replace, $l = '%', $r = NULL) {
if(!$r) {
$r = $l;
}
return str_replace(array_map(function($s) use ($l, $r) { return "$l$s$r"; }, array_keys($replace)), array_values($replace), $subject);
}
<?php
function yid($url) {
$pattern = '%^(?:https?://)?(?:www\.)?(?:youtu\.be/|youtube\.com(?:/embed/|/v/|/watch\?v=))([\w-]{10,12})$%x';
$result = preg_match($pattern, $url, $matches);
if ($result) {
return $matches[1];
}
return false;
}
{
"Potrefená Husa": "https://www.zomato.com/cs/praha/potrefen%C3%A1-husa-n%C3%A1rodn%C3%AD-nov%C3%A9-m%C4%9Bsto-praha-1/menu",
"Bistro OS": "https://www.zomato.com/cs/praha/bistroos-nov%C3%A9-m%C4%9Bsto-praha-1/menu",
"U Medvídků": "https://www.zomato.com/cs/praha/restaurace-u-medv%C3%ADdk%C5%AF-star%C3%A9-m%C4%9Bsto-praha-1/menu",
"Modrá zahrada": "https://www.zomato.com/cs/praha/modr%C3%A1-zahrada-star%C3%A9-m%C4%9Bsto-praha-1/menu",
"La Piccola Perla": "https://www.zomato.com/praha/la-piccola-perla-star%C3%A9-m%C4%9Bsto-praha-1/menu",
"Café Louvre": "https://www.zomato.com/praha/caf%C3%A9-louvre-nov%C3%A9-m%C4%9Bsto-praha-1/menu",
"Hlávkův Dvůr": "https://www.zomato.com/praha/hl%C3%A1vk%C5%AFv-dv%C5%AFr-1-nov%C3%A9-m%C4%9Bsto-praha-1/menu"
}

SVG

<!-- definice SVG spritu -->
<svg class="shape-defs" width="0" height="0" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <symbol id="shape-star" viewBox="0 0 23 21">
    <path  d="M11.5 16.34l-5.43 2.85 1.04-6.04-4.39-4.28 
    6.07-.88 2.71-5.49 2.71 5.49 6.07.88-4.39 4.28 1.04 6.04-5.43-2.85zm0 0"/>
  </symbol>
 
@ViliamKopecky
ViliamKopecky / reboot.styl
Created March 25, 2016 17:05
Stylus port of _reboot.scss
$font-family-sans-serif = -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif
$font-family-serif = Georgia, "Times New Roman", Times, serif
$font-family-monospace = Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace
$font-size-root ?= 16px
$font-family-base = $font-family-sans-serif
$font-size-base ?= 1rem
$line-height-base ?= 1.5
$body-color ?= #111
$body-bg ?= #FFF

Keybase proof

I hereby claim:

  • I am viliamkopecky on github.
  • I am viliamkopecky (https://keybase.io/viliamkopecky) on keybase.
  • I have a public key ASDovpmshl5RlF9blUYjcFOGva0XrOU5rqAU7_wP6JPargo

To claim this, I am signing this object: