Skip to content

Instantly share code, notes, and snippets.

View jsor's full-sized avatar
💨

Jan Sorgalla jsor

💨
View GitHub Profile
@jsor
jsor / test.php
Last active August 29, 2015 14:06 — forked from anonymous/test.php
<?php
require 'vendor/autoload.php';
$loop = \React\EventLoop\Factory::create();
$filesystem = new \React\Filesystem\Filesystem($loop);
$loop->addTimer(0.0001, function() use ($filesystem) {
$file = $filesystem->file(__FILE__);
$file->exists()->then(function() use ($file) {
echo __FILE__ . ' exists', PHP_EOL;
@jsor
jsor / CoroutineTest.php
Last active July 31, 2017 12:16
React/Promise coroutine
<?php
namespace React\Promise;
class CoroutineTest extends \PHPUnit_Framework_TestCase
{
public function testResolvedValueEqualsFinalYield()
{
$gen = function () {
$a = (yield 21);

Keybase proof

I hereby claim:

  • I am jsor on github.
  • I am jsor (https://keybase.io/jsor) on keybase.
  • I have a public key whose fingerprint is 4C8B 04C1 C4F3 8711 3ECC D939 8708 F3EE CCA6 FDFA

To claim this, I am signing this object:

@jsor
jsor / ReactLoopQueue.php
Created May 5, 2015 14:29
ReactLoopQueue
<?php
namespace React\Promise\Queue;
use React\EventLoop\LoopInterface;
class ReactLoopQueue implements QueueInterface
{
private $loop;
@jsor
jsor / gist:b77fe49e08b8c9ffb7e9
Last active December 17, 2015 09:36
ReactPHP needs improving, any ideas?
<?php
namespace App\ProcessManager\Billing;
use App\Read\Billing\Queries\GetDefaultPlan;
use App\Read\Identity\Queries\UserWithId;
use App\Read\Identity\UserDto;
use App\Services\Bus\BillingCommandBus;
use App\Services\Bus\BillingQueryBus;
use App\Services\Bus\IdentityQueryBus;
<?php
function resolve($promiseOrValue = null)
{
if ($promiseOrValue instanceof ReactPromiseInterface) {
return $promiseOrValue;
}
// Create a React\Promise from a foreign promise
if ($promiseOrValue instanceof FigPromiseInterface) {
@jsor
jsor / Entity.php
Created December 2, 2017 13:08
Example setup for jsor/doctrine-postgis working with geometry objects
<?php
namespace DoctrinePostGISExample;
use Doctrine\ORM\Mapping as ORM;
use GeoIO\Geometry\Point;
/**
* @ORM\Entity
* @ORM\Table(