Skip to content

Instantly share code, notes, and snippets.

View PanJarda's full-sized avatar

Jaroslav Pernica PanJarda

  • Prague, Czech Republic
View GitHub Profile
<?php
(function($routes, $uri, $method) {
(function($res) {
array_key_exists('__handler', $res[1])
&& $res[1]['__handler']($res[0], null);
})(
array_reduce(
array_merge(
['/'],
explode(
@PanJarda
PanJarda / data.xml
Created April 8, 2018 20:39
XML->HTML over XSLT
<data>
<brand>Jennifer Doe</brand>
<title>About Me</title>
<routes>
<route href="/about">About Me</route>
<route href="/research">Research</route>
<route href="/publications">Publications</route>
<route href="/teaching">Teaching</route>
<route href="/gallery">Gallery</route>
<route href="/contact">Contact &amp; Meet Me</route>
@PanJarda
PanJarda / output.txt
Last active April 8, 2018 18:13
XML2SQL over XSLT
SELECT
count(`a.Karma`) AS `karma`,
`a.Title` AS `title`,
`a.Content`,
`a.Published`,
`u.id`,
`u.Name`
@PanJarda
PanJarda / domexpbind.html
Created January 8, 2018 09:19
One way expression binding like lit-html
<!DOCTYPE html>
<title>Dom expression binding</title>
<body>
<script>
/**
* placeholder element
*/
function $() {
const DOMNode = document.createTextNode('{{}}');
return {
@PanJarda
PanJarda / hyper-nitty-gritty.js
Created January 2, 2018 21:58 — forked from WebReflection/hyper-nitty-gritty.js
hyperHTML, the nitty gritty
// used to retrieve template content
const templates = new Map;
// used to retrieve node updates
const updates = new WeakMap;
// hyperHTML, the nitty gritty
function hyperHTML(chunks, ...interpolations) {
// if the static chunks are unknown
@PanJarda
PanJarda / dame.c
Last active December 19, 2017 11:45
Turkish draughts in c
#include <stdio.h>
#include <stdlib.h>
#define BSIZE 8
#define ERRSCAN 1
#define ERRMEM 2
typedef struct vec {
char x;
char y;
@PanJarda
PanJarda / toy-interpreter.js
Last active November 11, 2017 23:52
Toy - concatenative, functional, stack-based, truly postfix language.
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
let stack = [];
let consts = {
swapd: '[[swap] dip]',
popd: '[[pop] dip]',
{
"boardSize": [8,8],
"player1": -1,
"player2": 1,
"initialBoard": [
[0,0,0,0,0,0,0,0],
[1,1,1,1,1,1,1,1],
[1,1,1,1,1,1,1,1],
[0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0],
@PanJarda
PanJarda / toy.spec.txt
Last active November 10, 2017 17:59
toy - typed joy
; Number je nakej primitivni datovy typ treba
[ > ] (Number Number) : vetsi-mensi
[ - ] (vetsi-mensi) : odcitani-co-skonci-kladne
; ta typova anotace se da udelat i anonymni
[ - ] ( > ) : odcitani-co-skonci-kladne
@PanJarda
PanJarda / pico-elm.html
Last active December 16, 2017 16:48
Ultra pico elm architecture showcase without virtual-dom.
<!DOCTYPE html>
<title>pico-elm2</title>
<style>
body {
font-family: sans-serif;
background-color: #E1E7EF;
}
.app {
width: 200px;
overflow: auto;