Skip to content

Instantly share code, notes, and snippets.

My name is Mikuláš Dítě and I am an undergraduate student at Faculty of Information Technology of Czech Technical University in Prague.

Being an avid computer person (and technology-inclined individual in general), Japan has forever been engraved in my mind as a cradle of electronics. I would be visiting Japan for the following reasons:

One of my lifetime missions is improving education, both in my home country of the Czech republic and globally; a few years ago a fellow engineer from CTU and I founded a nonprofit organization aimed at providing world-class study materials in my native language for free to everybody. We have also produced numerous tools for managing educational content and video translations that helped many similar organizations throughout the world. Learning more about Japanese education system-which from what I learned differs greatly from ours-is an important goal of mine and visiting Japan would aid me greatly.

I find it very gratifying to learn new languages and Japanese language, in

@Mikulas
Mikulas / bench.sql
Created November 4, 2015 20:34
PostgresSQL replace vs regexp_replace benchmark
CREATE OR REPLACE FUNCTION benchmark() RETURNS INTEGER AS
$BODY$
BEGIN
FOR i IN 1..10000000 LOOP
PERFORM replace(replace('Lorem %ipsum_dolor sit amet, %consectetu%r_adipisici%ng elit,_sed do eiusmod', '%', '\%'), '_', '\_');
END LOOP;
return 1;
END
$BODY$
LANGUAGE 'plpgsql' ;
@Mikulas
Mikulas / mikulas.wanikani.wallpaper.plist
Last active September 21, 2015 21:20 — forked from zosiu/wk_wallpaper.rb
OS X WaniKani wallpaper
#!/usr/bin/env bash
DIR="/Users/mikulas/Dropbox/Images/Wallpapers/wanikani"
DAILY="$DIR/daily/$(date '+%Y%m%d').png"
if [[ -e "$DAILY" ]]; then
echo "Already generated today"
exit 1
fi
.PHONY: doc
doc:
apigen generate --source src/ --destination doc/api --title 'nextras/orm@master'
@Mikulas
Mikulas / git-afix
Created August 13, 2015 23:37
git-afix is a smart fixup tool that creates fixup commit with each staged file. Fixed revision is last rev that the file was changed in.
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
fixups=""
for FILE in $(git --no-pager diff --name-only --cached); do
# TODO limit to last merge commit
REF=$(git log -n 1 --follow --no-merges --pretty="format:%H" -- "$FILE")
fixups+="$REF $FILE"$'\n'
done
@Mikulas
Mikulas / .gitattributes
Created August 10, 2015 08:44
git composer.lock differ
/composer.lock -merge diff=composer.lock

Keybase proof

I hereby claim:

  • I am mikulas on github.
  • I am mikulas (https://keybase.io/mikulas) on keybase.
  • I have a public key whose fingerprint is 2153 10CC D48E 631A 5A82 7922 4D93 D382 6A09 8197

To claim this, I am signing this object:

@Mikulas
Mikulas / gist:0824db2fb28123e019e0
Created July 8, 2015 09:49
slovník report kš
Sal
než
ne
dolaru
lidi
druhu
momentu
bere
volena
státu
@Mikulas
Mikulas / gist:a5b95be4e4858c63b332
Last active December 3, 2018 11:15
PostgreSQL UTF-8 to ASCII folding and webalize
CREATE EXTENSION unaccent;
CREATE OR REPLACE FUNCTION webalize(varchar) RETURNS text AS $$
SELECT trim(both '-' from regexp_replace(lower(unaccent($1)), '[^a-z0-9]+', '-', 'g'));
$$ LANGUAGE SQL;
SELECT unaccent('Příliš žlutý kůň 91. stupeň!');
-- Prilis zluty kun 91. stupen!
SELECT webalize('Příliš žlutý kůň 91. stupeň!');
diff --git a/app/model/BaseManager.php b/app/model/BaseManager.php
index 4fb7ef3..e49f3f7 100644
--- a/app/model/BaseManager.php
+++ b/app/model/BaseManager.php
@@ -237,9 +237,9 @@ abstract class BaseManager extends Nette\Object
$table = ($table ?: $this->tableName);
$pk = $this->getPrimaryKey($table);
$id = $entity[$pk];
- unset($entity[$pk]);