Skip to content

Instantly share code, notes, and snippets.

<?php
error_reporting(E_ALL | E_STRICT);
/**
* To runs this example you will need the UUID PHP Extension http://pecl.php.net/package/uuid
*/
/**
* DomainModel Aggregate root for a Tweet
*
* The Aggregate root tracks all uncommitted events and can have old
* events replayed to it.
@salathe
salathe / results.txt
Created January 24, 2012 20:55
PHP array/string functions haystack/needle ordering
Array functions:
array_search $needle, $haystack
in_array $needle, $haystack
String functions:
strchr $haystack, $needle
stripos $haystack, $needle
stristr $haystack, $needle
strpos $haystack, $needle
strrchr $haystack, $needle
@cspray
cspray / cv-ring-description.md
Created January 27, 2012 15:55
A brief description of cv-ring and cv-pls

What is 'cv-ring', 'cv-pls' and 'delv-pls'

In the Stack Overflow PHP chat you may notice the regulars using tags like cv-pls, cv-ring and delv-pls. These tags are used only in the chat room to communicate with other users that a question or answer may need more votes to be closed or deleted. The PHP tag has a lot of inferior quality and duplicative information on Stack Overflow. We feel that inferior quality questions bring down the site and make it harder to find good information, particularly about PHP. By closing and merging these questions as appropriate you'll find the information you need quicker.

  • cv-ring is just a 'funny name' we give to the group of regulars who use the tags
  • cv-pls is an in-chat tag that communicates "Hey, this question may be of inferior quality. Check it out and, if you feel appropriate, cast a close vote."
  • delv-pls is an in-chat tag that communicates "Hey, this question has alr
@ha1t
ha1t / phppro_quote_count.php
Created April 20, 2012 09:54
PHPプロ!のnewsが何回他のニュースサイトから引用しているかチェックするスクリプトとか書いたなー
<?php
/**
* PHPプロ!のnewsで何回他のニュースサイトから
* 引用しているかチェックするスクリプト
*
*/
require_once 'HTTP/Client.php';
$g_target_url = 'http://www.phppro.jp/news/';
$g_start = 215;
@b-durand
b-durand / MockDbAdapter.php
Created August 20, 2012 21:58
PHPUnit Mock API with Zend\Db
<?php
$date = new DateTime();
$mockStatement = $this->getMock('Zend\Db\Adapter\Driver\Pdo\Statement');
$mockStatement->expects($this->once())->method('execute')->with($this->equalTo(array(
'timestamp' => $date->format(FormatterInterface::DEFAULT_DATETIME_FORMAT)
)));
$mockDbDriver = $this->getMockBuilder('Zend\Db\Adapter\Driver\Pdo\Pdo')
->disableOriginalConstructor()
@rsky
rsky / gist:3529774
Created August 30, 2012 14:36
rep2用 Nginx設定サンプル
server {
listen 443;
server_name rep2.example.com;
access_log /path/to/p2-php/data/logs/access.log main;
error_log /path/to/p2-php/data/logs/error.log;
ssl on;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers HIGH:!ADH:!MD5;
diff --git a/sapi/cli/config.m4 b/sapi/cli/config.m4
index cdfa1f7..9a1b98d 100644
--- a/sapi/cli/config.m4
+++ b/sapi/cli/config.m4
@@ -6,6 +6,23 @@ PHP_ARG_ENABLE(cli,,
[ --disable-cli Disable building CLI version of PHP
(this forces --without-pear)], yes, no)
+AC_CHECK_FUNCS(setproctitle)
+
@callado4
callado4 / behat-phantomjs-webdriver.md
Last active January 24, 2021 17:10
Instructions on how to make behat (with mink) use the phantomjs webdriver to run headless browser tests

Making behat use phantomjs for the tests

If you want to run it on phantomjs (a headless browser) you can add this profile to your behat.yml and you need phantomjs >= 1.8.0

phantomjs:
    extensions:
        Behat\MinkExtension\Extension:
            base_url: http://dev.local
            goutte: ~
            selenium2:
 wd_host: "http://localhost:8643/wd/hub" 
@ircmaxell
ircmaxell / README.md
Last active December 18, 2015 12:19
Compare Modified GC

To set this up, have 2 builds of PHP, one using the "master" branch, and one using my refactor branch. Configure the paths to the SAPI at the top of benchmark.php.

Note that it's hard-coded to look for php-src/Zend/bench.php, php-src/Zend/micro_bench.php and gc_test.php.