Skip to content

Instantly share code, notes, and snippets.

building stuff

Viliam Simko vsimko

building stuff
View GitHub Profile
feat (new feature)
fix (bug fix)
docs (changes to documentation)
style (formatting, missing semi colons, etc; no code change)
refactor (refactoring production code)
test (adding missing tests, refactoring tests; no production code change)
chore (updating grunt tasks etc; no production code change)
View import-from-string.js
// from
function esm(templateStrings, ...substitutions) {
let js = templateStrings.raw[0];
for (let i=0; i<substitutions.length; i++) {
js += substitutions[i] + templateStrings.raw[i+1];
return 'data:text/javascript;base64,' + btoa(js);
View lstlisting-sparql.tex
\usepackage[dvipsnames]{xcolor} %
\usepackage{listings} % syntax highlighting
View download-tnp-svg.js
// run this code in dev console when you selected your icon
var x = document.createElement('img')
x.src = document.querySelector('.iconPreview').style.backgroundImage.replace(/url\("/,'').replace(/"\)$/, '')
// or use this as a bookmark in your chrome
// Name: TNP Download
// URL: javascript:!(function() { var x = document.createElement('img'); x.src = document.querySelector('.iconPreview').style.backgroundImage.replace(/url\("/,'').replace(/"\)$/, ''); document.body.replaceWith(x) })()

The easiest way to create a microservice

mkdir micro-demo
cd micro-demo
yarn add micro
echo 'module.exports = () => "Welcome to Micro"' > index.js
yarn micro

Now browse to http://localhost:3000

View simple-vue-vuetify-test.html
<link href=',400,500,700|Material+Icons' rel="stylesheet">
<link href="" rel="stylesheet">
<script src=""></script>
<script src=""></script>
<script src=""></script>
<div id="app">
<input v-model="myinput">
<v-toolbar dense dark color="blue darken-2">
View optimize-pages-tree.js
#!/usr/bin/env node
// TODO: this is currently just a helper script included from ``
const fs = require('fs')
const yaml = require('js-yaml')
function firstObjectKey(obj) {
return Object.keys(obj)[0]
vsimko /
Last active Jan 15, 2018
How to add new page into biggis-docs
# install required stuff (you should have already installed it anyways)
pip install --user mkdocs
pip install --user mkdocs-material
sudo apt install nodejs

# clone the repo
git clone
cd biggis-docs
# Quick and dirty config hack for mkdocs pages.
# Created by Viliam Simko (
# License: MIT
# Generates `pages:` section within `mkdocs.yml` file.
# The sections are ordered by filenames, however the section
# titles are taken either from the first H1 within a document
View imagedata-from-img.js
// sending-a-file-as-multipart-through-xmlhttprequest
// change the id `USE-YOUR-ID`
const img = document.getElementById('USE-YOUR-ID');
// extracts image data from <img> element through canvas
const canvas = document.createElement('canvas');
You can’t perform that action at this time.