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 | |
| $request = $guzzleClient->get('/'); | |
| $request->addSubscriber(new \Guzzle\Plugin\Mock\MockPlugin(array( | |
| new \Guzzle\Http\Message\Response(200, null, json_encode(array( | |
| 'error' => 0, | |
| ))) | |
| ))); | |
| $response = $request->send(); |
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
| # log rotation for nginx+php-fpm stack on FreeBSD | |
| # File: /etc/newsyslog.conf | |
| /var/log/nginx/*.log 644 15 1000 @T00 JBCG /var/run/nginx.pid 30 | |
| /var/log/php_errors.log www:www 644 15 1000 @T00 JBCG /var/run/php-fpm.pid 30 |
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 | |
| /** | |
| * @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 | |
| */ | |
| function timestampToHttpDate($timestamp) { | |
| return gmdate('D, d M Y H:i:s', $timestamp) . ' GMT'; | |
| } |
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 | |
| $client = new \Predis\Client([ | |
| 'read_write_timeout' => 0, | |
| ]); | |
| while(true) { | |
| $message = $client->blpop('queue1', 0); | |
| } |
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 PhpAmqpLib\Connection\AMQPConnection; | |
| use PhpAmqpLib\Message\AMQPMessage; | |
| // connect | |
| $connection = new AMQPConnection('localhost', 5672, 'guest', 'guest'); | |
| // create channel | |
| $channel = $connection->channel(); |
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 PhpAmqpLib\Connection\AMQPConnection; | |
| use PhpAmqpLib\Message\AMQPMessage; | |
| // connect | |
| $connection = new AMQPConnection('localhost', 5672, 'guest', 'guest'); | |
| // create channel | |
| $channel = $connection->channel(); |
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 Psr\Log\LogLevel; | |
| class PsrLogAdapter extends \Psr\Log\AbstractLogger | |
| { | |
| private $_levelMap = array( | |
| LogLevel::EMERGENCY => CLogger::LEVEL_ERROR, | |
| LogLevel::ALERT => CLogger::LEVEL_ERROR, | |
| LogLevel::CRITICAL => CLogger::LEVEL_ERROR, |
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
| <?xml version="1.0" encoding="UTF-8" ?> | |
| <schema name="symfony" version="1.0"> | |
| <uniqueKey>id</uniqueKey> | |
| <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/> | |
| <fieldType name="string" class="solr.StrField" sortMissingLast="true" /> | |
| <field name="_version_" type="long" indexed="true" stored="true"/> | |
| <field name="_root_" type="string" indexed="true" stored="false"/> | |
| <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="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 | |
| function dropDirectory($path) { | |
| // drop included files and directories | |
| foreach(new \DirectoryIterator($path) as $file) { | |
| if($file->isDot()) { | |
| continue; | |
| } | |
| // drop dir |
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
| var http = require('http'); | |
| // create server | |
| var server = http.createServer(); | |
| // dispatch requests | |
| server.on('request', function(request, response) { | |
| response.writeHead(200, 'OK'); | |
| response.write('Requested ' + request.url); | |
| response.end(); |
OlderNewer