Skip to content

Instantly share code, notes, and snippets.

@JanTvrdik
JanTvrdik / Dumper.php
Last active August 29, 2015 13:58
JSOND - JSON compatibility test
<?php
/**
* This file is part of the Tracy (http://tracy.nette.org)
* Copyright (c) 2004 David Grudl (http://davidgrudl.com)
*/
namespace Tracy;
use Tracy;
<?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 October 26, 2014 16:31
StaticRouter benchmark

Benchmark for Nextras\StaticRouter

Source code

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

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 August 29, 2015 14:28
Nette Dev Kit
#!/bin/env bash
while read dir
do
sh -c "cd \"$dir\" && echo && pwd && $*"
done
<?php
/**
* Tools for accessing "invisible" properties and calling "invisible" methods
*
* @author Jan Tvrdík
* @license MIT
*/
class VisibilityHack
{
/**
<?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
{
@JanTvrdik
JanTvrdik / ReplicatingContainer.php
Created August 19, 2010 13:13
ReplicatingContainer
<?php
/**
* Magický, komponenty na požádání tvořící kontejner
*
* @author Jan Tvrdík
*/
class ReplicatingContainer extends Nette\ComponentContainer
{
/** @var callback */
public $factoryCallback;
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" \
<?php
class Foo
{
/**
* @return Foo|int|NULL|TRUE|FALSE|bool
*/
public function test()
{
}