Add a DSL to the PHP Finite package, borrowed from the Ruby StateMachine gem.
In your Stateful Class, add the stateMachineConfig() method and call initStateMachine() method at initialization (__contruct() method).
Example
Add a DSL to the PHP Finite package, borrowed from the Ruby StateMachine gem.
In your Stateful Class, add the stateMachineConfig() method and call initStateMachine() method at initialization (__contruct() method).
Example
| #!/bin/bash | |
| # Put this file at: .git/hooks/post-checkout | |
| # and make it executable | |
| # You can install it system wide too, see http://stackoverflow.com/a/2293578/685587 | |
| PREV_COMMIT=$1 | |
| POST_COMMIT=$2 | |
| NOCOLOR='\e[0m' |
| <?php | |
| error_reporting(E_ALL); | |
| class StringTypeHandler { | |
| public function length() { | |
| return strlen($this); | |
| } | |
| } |
| # -*- mode: ruby -*- | |
| # vi: set ft=ruby : | |
| this_dir = File.dirname(__FILE__) + "/" | |
| require this_dir + "vagrant/hostmaster.rb" | |
| Vagrant::Config.run do |config| | |
| # define some colors for our output | |
| def colorize(text, color_code) "#{color_code}#{text}\033[0m" end |
| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| <?php | |
| namespace Doctrine\ORM\Query\Filter; | |
| abstract class SQLFilter | |
| { | |
| final public function __construct(Connection $conn); | |
| final function setParameter($name, $value, $type); | |
| #!/usr/bin/env php | |
| <?php | |
| $paths = array(); | |
| if (isset($_SERVER['argv'])) | |
| { | |
| $paths = $_SERVER['argv']; | |
| array_shift($paths); | |
| if (!$paths) |
| <?php | |
| if($enable_graphite) | |
| { | |
| $fp = @fsockopen('127.0.0.1', 2003, $errno, $errstr, 1); | |
| if($fp) | |
| { | |
| $out = array(); |