Skip to content

Instantly share code, notes, and snippets.

<?php
// iterator impl:
class MapIterator extends IteratorIterator {
private $f;
public function __construct($f, $inner) {
parent::__construct($inner);
$this->f = $f;
@igorw
igorw / index.php
Created April 21, 2011 00:05
Silex app with global Twig layout
<?php
require __DIR__.'/silex.phar';
$app = new Silex\Application();
$app->register(new Silex\Extension\TwigExtension(), array(
'twig.path' => __DIR__.'/views',
'twig.class_path' => __DIR__.'/vendor/twig/lib',
));
@igorw
igorw / gist:4475804
Last active October 4, 2019 15:32
Composer Versioning
-- place this file in
-- $(brew --prefix highlight)/share/highlight/themes/yawn.theme
Description = "Yawn"
Default = { Colour="#000000" }
Canvas = { Colour="#ffffff" }
Number = { Colour="#812024" }
Escape = { Colour="#696969" }
String = { Colour="#006124" }
commit 935f32fd0941a5c54e1931f0668e05c52daa66d4
Author: Igor Wiedler <igor@wiedler.ch>
Date: Thu May 31 19:19:40 2012 +0200
Prototype of async DNS client
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..22d0d82
--- /dev/null
@igorw
igorw / FooController.php
Created September 5, 2012 22:13
Silex convention-based controllers
<?php
// src/Foobar/Controller/FooController.php
namespace Foobar\Controller;
class FooController
{
public function helloAction($request)
{
@igorw
igorw / gist:4108347
Created November 19, 2012 00:38
React v0.2.4 release notes

React v0.2.4 is more awesome

DNS promises

This release has two major improvements. The first one is that react/dns is now using a promise based API. In case you missed it, react/promise is a PHP library for promises. Take a look at the README and familiarize yourself with it, as it will be used by many libs in the react ecosystem, including core.

The previous API was:

$dns->resolve('igor.io', function ($ip) {

echo "Yay, the IP is $ip.\n";

@igorw
igorw / silex-php+twig+TwigBrige+translation.php
Created November 5, 2011 11:53 — forked from mTorres/silex-php+twig+TwigBrige+translation.php
Gist Sample to enable Twig + TwigTranslation bridge to Silex
<?php
require_once __DIR__ . '/../lib/vendor/Silex/silex.phar';
$app = new Silex\Application();
$app['debug'] = true;
// Registering Symfony\Yaml and Symfony\Config
$app['autoloader']->registerNamespace('Symfony', __DIR__.'/../lib/vendor/symfony/src');
<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
class Csp implements HttpKernelInterface
{
private $app;
private $options;
@igorw
igorw / client-slow.php
Created October 11, 2012 23:46
React Http Client
<?php
require __DIR__.'/vendor/autoload.php';
use React\Curry\Util as Curry;
$projects = array(
'react-php/react',
'cboden/Ratchet',
'nrk/predis-async',