This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| abstract class Tree {} | |
| class Leaf extends Tree { | |
| function __construct($n) { | |
| $this->value = $n; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Request { | |
| public $get; | |
| public $post; | |
| public $server; | |
| function __construct($server, $get, $post) { | |
| $this->get = $get; | |
| $this->post = $post; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Smaller and friendlier (?) alternative to https://github.com/badphp/logger | |
| function logger($path, $priority=0) { | |
| return function($level, $msg) use($path, $priority) { | |
| if ($level > $priority) { | |
| return false; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use App\Config\Configurator; | |
| use App\Config\ConflictException; | |
| use App\HTTP\Message; | |
| use App\HTTP\Request; | |
| use App\HTTP\Response; | |
| class ConfiguratorTest extends \PHPUnit_Framework_TestCase |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace App; | |
| use App\Config\Configurator; | |
| use App\HTTP\Request; | |
| class App { | |
| private $name; | |
| private $config; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function partial1(/* A */ $a, /* (A, B) => C */ callable $f) /* B => C */ { | |
| return function(/* B */ $b) use($a, $f) { | |
| return $f($a, $b); | |
| }; | |
| } | |
| /* A :: String | |
| * B :: String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function match() { | |
| func_num_args() or die('Remember the milk?'); | |
| $fnm = function() { return true; }; | |
| $fns = func_get_args(); | |
| if (is_string($match = func_get_arg(0))) { | |
| $fnm = function() use($match) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pygame | |
| import math | |
| from random import random, randint, uniform | |
| WIDTH = 640.0 | |
| HEIGHT = 480.0 | |
| CENTER = (WIDTH / 2.0, HEIGHT / 2.0) | |
| class SceneManager: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * PHP Doc. Tests | |
| * ============== | |
| * | |
| * Unit testing library that extract tests from documentation. | |
| * | |
| * This is only a POC and should not be used in production. | |
| * | |
| * Under the WTFPL-2.0 license. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name OK Plus | |
| // @namespace guide42 | |
| // @description Enchant OK Cupid | |
| // @include http://www.okcupid.com/* | |
| // @include https://www.okcupid.com/* | |
| // @version 0.1 | |
| // ==/UserScript== | |
| ;(function($, window, undefined) { |