Skip to content

Instantly share code, notes, and snippets.

// by Erik Wrenholt
import java.util.*;
class Mandelbrot
{
static int BAILOUT = 16;
static int MAX_ITERATIONS = 1000;
private static int iterate(float x, float y)
{
@ichiriac
ichiriac / weby.php
Created October 16, 2013 17:17
Have some fun with pthreads
<?php
define('CRLF', "\r\n");
class HaveToWork extends Thread {
protected $wait;
public $socket = null;
public function __construct() {
$this->wait = true;
$this->start();
}
public function run() {
@ichiriac
ichiriac / jPrototype.php
Last active December 21, 2015 20:49
An experiment to implement the Javascript Prototype principle in PHP 5.3
<?php
class jPrototype {
protected static $prototype = array();
public static function prototype() {
if ( !self::$prototype ) {
self::$prototype = new self();
}
return self::$prototype;
}
public function __set($property, $value) {
@ichiriac
ichiriac / merge-array.php
Created August 15, 2012 09:00
Clean way to recursivelly merge an array (secure & fast way)
<?php
/**
* An array merging helper
* @params array $original
* @params array $additionnal
* @return array
*/
function merge_array( $original, $additionnal )
{
if ( empty($additionnal) ) return $original;