Skip to content

Instantly share code, notes, and snippets.

<?php
/*
* Generated by RapidDataMapper on 2011-11-02 13:09:36.
*
* Copyright (c) 2010 Martin Wernståhl.
* All rights reserved.
*/
class ArtistCollectionBase extends Rdm_Collection
{
<?php
$loop = EventLoop::getDefaultLoop();
function doSomething()
{
global $loop;
// Create a recurring timer
$timer = new TimerEvent(..., 1, 1);
@m4rw3r
m4rw3r / php-libev API vs libev API.rst
Created January 27, 2012 10:34
Current feature-set of php-libev vs libev

Differences in the PHP-libev vs libev API

This list is subject to change as the PHP-libev API changes. The goal of this list is to keep track of differences and see if stuff needs to change, it also serves as a todo list for stuff which currently is not implemented in PHP-libev.

=========================================== =============================================== libev PHP-libev

Context *ctx = malloc(sizeof(Context));
Context_init(ctx);
uint64_t varsum = Context_allocVariable(ctx);
uint64_t varn = Context_allocVariable(ctx);
uint64_t vara = Context_allocVariable(ctx);
uint64_t varb = Context_allocVariable(ctx);
uint64_t vari = Context_allocVariable(ctx);
Instruction instructions[] = {
#ifndef CARRAYMACROS_H
#define CARRAYMACROS_H 1
#include <inttypes.h>
#include <stdio.h>
#define ARRAY_SIZE(array) array ## _num
#define ARRAY_MAX(array) array ## _max
#define ARRAY_CDECL(array, type) \
# This is a comment
# Plain constant:
Dummystring = "foobar"
# Parameters to be injected from outside (CLI or another processor) and their respective types:
Parameters {
target_file: string,
integration_time: uint32
}
ins NOP()
{
/* Empty */
}
ins END()
{
goto end_eval;
}
<?php
public function getService($service)
{
if(isset($this->_instances[$service]))
{
return $this->_instances[$service];
}
if( ! isset($this->_loaders[$service]))
<?php
namespace React\EventLoop;
use libev\EventLoop;
use libev\IOEvent;
class LibevLoop
{
protected $loop = null;
@m4rw3r
m4rw3r / gist:2775309
Created May 23, 2012 13:45
InjectStack middleware for ChunkedEncoding
<?php
/*
* Created by Martin Wernståhl on 2011-04-25.
* Copyright (c) 2011 Martin Wernståhl.
* All rights reserved.
*/
namespace Inject\Stack\Middleware;
use \Inject\Stack\MiddlewareInterface;