Skip to content

Instantly share code, notes, and snippets.

Working from home

David Grudl dg

Working from home
Block or report user

Report or block dg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:c237aae31147a5e589d1
<td><span class=select></span></td>
var range = document.createRange();
dg / Nette
Created Aug 19, 2014
DI: Symfony versus Nette
View Nette
newsletter_factory: NewsletterFactory
newsletter_manager: @newsletter_factory::get(@templating)
View gist:dbe8c58e5866d9fe5bf9
# spaces are OK
- key1: # empty means NULL
key2: hello
key3: 123
# tabs are confusing
- key1:
key2: hello
View gist:7d503bbe93874309ddfa
- RouterFactory()::createRouter(%mode%)::start()
- MyClass( @service(123)::foo(), abc )
View after.php
class FooControl extends Nette\Application\UIControl
public function render()
->render(__DIR__ . '/control.latte');
dg / gist:9932198
Created Apr 2, 2014
Latte example
View gist:9932198
<table n:if="$items">
<tr n:foreach="$items as $item">
View TestCase.php
* This file is part of the Nette Tester.
* Copyright (c) 2009 David Grudl (
namespace Tester;
dg / websocket.html
Created Aug 11, 2013
WebSocket communication between PHP and single client
View websocket.html
<!doctype html>
if ("WebSocket" in window) {
var ws = new WebSocket("ws://");
ws.onopen = function() {
ws.onerror = function(e) {
dg / output detector.php
Created Jun 20, 2013
How can I find out where my output started?
View output detector.php
ob_start(function($s, $flag) {
$e = new \Exception;
$s = nl2br("Output started here:\n{$e->getTraceAsString()}\n\n") . $s;
return $s;
}, 2);
dg / gist:5616877
Created May 21, 2013
Workaround for missing ::class in PHP < 5.5
View gist:5616877
use Nette\Http;
echo Http\Request::class; // prints 'Nette\Http\Request' since PHP 5.5
echo Http\Request\type::of; // prints 'Nette\Http\Request' alwyas ;)
You can’t perform that action at this time.