Skip to content

Instantly share code, notes, and snippets.

@mgrabovsky
mgrabovsky / matematicky-seminar.md
Last active August 26, 2019 10:56
Seznam titulů vydaných v edicích Matematický seminář a Matematika pro vysoké školy technické SNTL
  1. Vlach, M.: Základní numerické metody (1971)
  2. Kohout, V.: Diferenciální geometrie (1971)
  3. Havrda, J.: Matematické programování (1972?)
  4. Kufner, A.: Geometrie Hilbertova prostoru (1973, 1975?)
  5. Beran, L.: Grupy a svazy (1974)
  6. Vlach, M.: Optimální řízení regulovatelných systémů (1975?)
  7. Ježek, J.: Univerzální algebra a teorie modelů (1976?)
  8. ???
  9. Boček, L.: Tenzorový počet (1976)
  10. Pondělíček, B.: Algebraické struktury s binárními operacemi (1977)
module Melsort (melsort) where
-- TODO: Linked lists are not the best for this algorithm performance-wise.
-- Consider a different structure, perhaps Vector.
-- TODO: Some preconditions are required.
push :: Ord a => a -> [[a]] -> [[a]]
push x [] = [[x]]
push x ([y]:ls) -- TODO: Is it possible that ls /= [] here? It's not.
| x <= y = [x, y ] : ls
@mgrabovsky
mgrabovsky / index.md
Last active August 25, 2018 00:27
JavaScript and static typing

This is an incomplete list of tools that aid in detecting type errors in JavaScript and statically typed languages that compile to JavaScript.

  • Flow is a type checker with gradual typing capabilities, classes, parametric polymorphism with constraints (bounded polymorphism), function overloading, union and intersection types, and modules.

  • TypeScript is a typed superset of JavaScript (todo: which version? ES6/7?) backed by Microsoft.It features contextual typing, interfaces and classes, parametric polymorphism (generics with

@mgrabovsky
mgrabovsky / base.css
Last active September 13, 2017 18:14
ČSFD stats vis
/*! normalize.css v3.0.2 | MIT License | git.io/normalize */
html {
font-family: sans-serif;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
body { margin: 0; }
@mgrabovsky
mgrabovsky / gist:1808014
Last active July 30, 2016 12:25
Scoped temporary variable in C++
// http://stackoverflow.com/a/2553109/227159
/**
* In its constructor temp_value stores a reference to a variable and a copy of the
* variable's original value. In its destructor it restores the referenced variable
* to its original value. So, no matter what you did to the variable between
* construction and destruction, it will be reset when the temp_value object goes out
* of scope.
*/
@mgrabovsky
mgrabovsky / gist:cbcc9c1fc81f371716f5
Created April 22, 2015 19:07
All GCC sanity warning flags
gcc -v --help 2>&1 | awk '/-W/ && !/=/ && !/[oO]ptions/ && !/larger-than/ { print $1 }'
@mgrabovsky
mgrabovsky / Makefile1
Last active July 22, 2016 12:36
Self-documenting Makefile
#:This list
.PHONY: ?
?:;@for file in "Makefile $$(perl -lne 'print for m|^include\s+(.*)$$|g' Makefile)"; do \
perl -0777 -ne 'while (m/#:\s*(.*?)\n\.PHONY:\s*(.*?)\n/sg) { print "make $$2\t# $$1\n"; }' "$${file}"; \
done | sort -u | column -ts $$'\t'
# Source: https://github.com/gtramontina/sourcing/blob/023cae5/Makefile#L68-L72
@mgrabovsky
mgrabovsky / .block
Last active April 10, 2016 08:44 — forked from mbostock/.block
Collapsible Tree
license: gpl-3.0
@mgrabovsky
mgrabovsky / gist:7912279
Created December 11, 2013 15:22
Generate a sequence akin to 1, 2, 5, 10, 20, 50, ... Useful for log scales and such.
import itertools
([1, 2, 5][i % 3] * 10**(i // 3) for i in itertools.count(0))