This file contains 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 | |
// http://www.cplusplus.com/reference/queue/queue/ | |
class Queue { | |
private $_queue = array(); | |
public function size() { | |
return count($this->_queue); | |
} |
This file contains 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 | |
// http://www.cplusplus.com/reference/stack/stack/ | |
class Stack { | |
private $_stack = array(); | |
public function size() { | |
return count($this->_stack); | |
} |
This file contains 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 Node { | |
public $level = 1; | |
public $data = NULL; | |
public $left = NULL; | |
public $right = NULL; | |
public function __construct($data = NULL) { | |
$this->data = $data; |
This file contains 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
# Start with the offical image for PHP 5.6 | |
FROM php:5.6 | |
# Install additonal packages | |
RUN apt-get update | |
RUN apt-get install -y git unzip libmcrypt-dev libmemcached-dev libz-dev | |
RUN pecl install memcached | |
# Install/Enable PHP extensions | |
RUN docker-php-ext-install pcntl mcrypt |
This file contains 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
app: | |
build: | |
image: app | |
dockerfile_path: Dockerfile | |
cached: true |
This file contains 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
- type: parallel | |
steps: | |
- service: app | |
command: vendor/bin/phpunit |
This file contains 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
build: | |
build: | |
image: app | |
dockerfile_path: Dockerfile | |
cached: true | |
volumes_from: | |
- data | |
test: | |
build: | |
image: app |
This file contains 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 | |
if($forwardedFor=$request->headers->get(‘X_FORWARDED_FOR’)){ | |
$forwardedIps=explode(“, “,$forwarded_for); | |
foreach($forwardedIpsas$forwardedIp){ | |
if(\Symfony\Component\HttpFoundation\IpUtils::checkIp($forwardedIp,$proxyIps)){ | |
$proxyIps[]=$request->server->get(‘REMOTE_ADDR’); | |
break; |
This file contains 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 | |
private function isFromTrustedProxy() { | |
return self::$trustedProxies&&IpUtils::checkIp($this->server->get(‘REMOTE_ADDR’), self::$trustedProxies); | |
} | |
?> |
This file contains 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 | |
/** | |
* Tor Page Crawler | |
* | |
* Download web pages anonymously using the Tor network. | |
* Usage Example: | |
* $tor = new Tor(); | |
* | |
* $tor->setUrl('http://zacharyflower.com'); |