Skip to content

Instantly share code, notes, and snippets.

View jaandrle's full-sized avatar
🚀
Exploring

Jan Andrle jaandrle

🚀
Exploring
View GitHub Profile
@jaandrle
jaandrle / 0.md
Last active May 8, 2021 08:54
github-releases.js – helper for working with “packages” (files) in GitHub releases. (JS)
@jaandrle
jaandrle / means.js
Last active March 21, 2021 21:57
Geothmetic Meandian comparing with others (implementation `gmdn` in JavaScript)
const means= (()=>{
return { gmdn, median, meanArithmetic, meanGeometric };
/* See
* https://xkcd.com/2435/
* https://www.explainxkcd.com/wiki/index.php/2435:_Geothmetic_Meandian
* For sure, this is a joke!
* Stats tip: If you aren't sure whether to use the mean, median,
* or geometric mean, just calculate all three, then repeat until it converges
*/
@jaandrle
jaandrle / game-tinyFlappyBird.html
Created January 31, 2021 21:42
Tiny Flappy Bird as Web Component
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<script>
(function component(){
class GameTinyFlappyBird extends HTMLElement{
connectedCallback(){
let state= initialState(this);
@jaandrle
jaandrle / gist:a69323d8aee92b9083f28d5da28318d2
Created October 17, 2020 18:59 — forked from metaskills/gist:6414713
Jekyll tasks/post to help create a new post.
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "Usage: provide a title argument."
exit -1
else
title="$@"
fi
d=$(date +"%Y-%m-%d")
@jaandrle
jaandrle / 00_errors.js
Last active July 9, 2021 16:22
JavaScript: errors idea
const errors= (function(module){
return module();
})(function(){
const proxy_keys= [ "create", "isInstance" ];
const proxy_obj= { get(target, prop){ return prop===Symbol.iterator ? target[Symbol.iterator].bind(target) : target[proxy_keys.indexOf(prop)]; } };
/**
* This subclass of Error supports chaining.
* If available, it uses the built-in support for property `.cause`.
* Otherwise, it sets it up itself.
*
@jaandrle
jaandrle / 00-info.md
Last active March 21, 2021 14:37
JavaScript aditional math utils
@jaandrle
jaandrle / 0) Bookmarklets.md
Last active March 13, 2025 15:21
Bookmarklets
const debugCordova= (function autoRunCordovaAppInspect(){
const filter= Array.prototype.filter;
let /* filters */
device_filter, app_filter, last_state;
const /* get elements */
devicesElements= ()=> filter.call(document.getElementsByClassName("device"), el=> el.id!=="device:localhost"),
appTest= browser_candidate_el=> browser_candidate_el.getElementsByClassName("browser-name")[0].textContent.indexOf(app_filter)!==-1,
browsersElements= wrapper_el=> wrapper_el.getElementsByClassName("browser"),
actionElementFilter= wrapper_el=> filter.call(wrapper_el.getElementsByClassName("action"), el=> el.textContent==="inspect")[0];