Skip to content

Instantly share code, notes, and snippets.

@JanTvrdik
JanTvrdik / Dumper.php
Last active Aug 29, 2015
JSOND - JSON compatibility test
View Dumper.php
<?php
/**
* This file is part of the Tracy (http://tracy.nette.org)
* Copyright (c) 2004 David Grudl (http://davidgrudl.com)
*/
namespace Tracy;
use Tracy;
View createParagraphs.php
<?php
function createParagraphs($html)
{
$html = '<meta http-equiv="content-type" content="text/html;charset=utf-8"><body>' . $html;
$document = new DOMDocument();
$document->loadHTML($html);
$body = $document->getElementsByTagName('body')->item(0);
$inlineTags = ['a', 'b', 'del', 'em', 'i', 'img', 'ins', 'small', 'span', 'strong'];
$create = TRUE;
@JanTvrdik
JanTvrdik / bench.md
Created Oct 26, 2014
StaticRouter benchmark
View bench.md

Benchmark for Nextras\StaticRouter

Source code

Test __construct:
  StaticRouter                21 ms         +0 %
  Route + RouteList         1392 ms      +6529 %
 Route + global filter 244 ms +1062 %
View keybase.md

Keybase proof

I hereby claim:

  • I am JanTvrdik on github.
  • I am jantvrdik (https://keybase.io/jantvrdik) on keybase.
  • I have a public key whose fingerprint is E42B 2FFA 3D04 F044 087B BB87 424D C177 9989 AB3A

To claim this, I am signing this object:

@JanTvrdik
JanTvrdik / do
Last active Aug 29, 2015
Nette Dev Kit
View do
#!/bin/env bash
while read dir
do
sh -c "cd \"$dir\" && echo && pwd && $*"
done
View VisibilityHack.php
<?php
/**
* Tools for accessing "invisible" properties and calling "invisible" methods
*
* @author Jan Tvrdík
* @license MIT
*/
class VisibilityHack
{
/**
View DatePicker.php
<?php
/**
* Form control for selecting date
*
* Internally holds date as DateTime instance which is also returned by getValue method
*
* @author Jan Tvrdík
*/
class DatePicker extends Nette\Forms\FormControl
{
View ReplicatingContainer.php
<?php
/**
* Magický, komponenty na požádání tvořící kontejner
*
* @author Jan Tvrdík
*/
class ReplicatingContainer extends Nette\ComponentContainer
{
/** @var callback */
public $factoryCallback;
View git-remove-diacritics.sh
git filter-branch -f --msg-filter '
sed \
-e "s/\xC4\x9B/e/g" \
-e "s/\xC5\xA1/s/g" \
-e "s/\xC4\x8D/c/g" \
-e "s/\xC5\x99/r/g" \
-e "s/\xC5\xBE/z/g" \
-e "s/\xC3\xBD/y/g" \
-e "s/\xC3\xA1/a/g" \
-e "s/\xC3\xAD/i/g" \
View pipe.php
<?php
class Foo
{
/**
* @return Foo|int|NULL|TRUE|FALSE|bool
*/
public function test()
{
}