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 | |
$queryConnection = new \mysqli($host, $username, $password, $database); | |
$killConnection = new \mysqli($host, $username, $password, $database); | |
// Execute the query | |
$queryConnection->query($sql, MYSQLI_ASYNC | MYSQLI_USE_RESULT); | |
// Poll for results | |
$start = microtime(true); | |
do { |
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 | |
$passes = 0; //Init passes | |
$sieveSize = 1000000; //Set sieve size | |
$runTime = 10; //The amount of seconds the script should be running for | |
$stopTime = microtime(true) + $runTime; | |
$q = sqrt($sieveSize); | |
while (microtime(true) < $stopTime) { | |
$factor = 3; | |
$rawbits = []; |
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 PHPUnit\Framework\TestListener; | |
class OutputListener implements TestListener | |
{ | |
public function addError(PHPUnit_Framework_Test $test, Exception $e, $time) | |
{ | |
echo PHP_EOL; | |
echo PHP_EOL . 'ERROR: ' . get_class($test) . ' ' . $test->getName(); | |
echo PHP_EOL; |
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
const chromium = require('chrome-aws-lambda'); | |
const puppeteer = require('puppeteer-core'); | |
const crypto = require('crypto'); | |
const AWS = require('aws-sdk'); | |
const hashResult = (data) => { | |
const hashDigest = crypto.createHash('md5'); | |
hashDigest.update(data); | |
return hashDigest.digest('hex'); | |
}; |
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 | |
$pdo = new PDO('mysql:host=localhost;dbname=test', 'dbuser', 'dbpassword'); |
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 MyProject\Cli\Command; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Input\InputOption; | |
use Symfony\Component\Console\Output\OutputInterface; | |
class DbMigrate extends \Symfony\Component\Console\Command\Command | |
{ |
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 Ramsey\Uuid\Uuid; | |
/** | |
* Helper class for dealing with input data (e.g. data sent over HTTP, API responses, | |
* deserialized data from storage etc). When accessing items this class automatically | |
* checks that it exists and casts the value to the expected type. If it does not exist a default value is returned. | |
*/ | |
class InputData implements \ArrayAccess, \Countable, \IteratorAggregate, \JsonSerializable | |
{ |
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 | |
$url = 'http://datatables.yajrabox.com/fluent/basic-object-data?draw=1&columns%5B0%5D%5Bdata%5D=id&columns%5B0%5D%5Bname%5D=id&columns%5B0%5D%5Bsearchable%5D=true&columns%5B0%5D%5Borderable%5D=true&columns%5B0%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B0%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B1%5D%5Bdata%5D=name&columns%5B1%5D%5Bname%5D=name&columns%5B1%5D%5Bsearchable%5D=true&columns%5B1%5D%5Borderable%5D=true&columns%5B1%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B1%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B2%5D%5Bdata%5D=email&columns%5B2%5D%5Bname%5D=email&columns%5B2%5D%5Bsearchable%5D=true&columns%5B2%5D%5Borderable%5D=true&columns%5B2%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B2%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B3%5D%5Bdata%5D=created_at&columns%5B3%5D%5Bname%5D=created_at&columns%5B3%5D%5Bsearchable%5D=true&columns%5B3%5D%5Borderable%5D=true&columns%5B3%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B3%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B4%5D%5Bdata%5D=updated_at&columns%5B4%5D%5Bname%5D=updated_at&columns%5 |
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 Tag { | |
private $name; | |
private $attributes = []; | |
private $content = []; | |
public function __construct($name) { | |
$this->name = $name; | |
} | |
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 | |
$errors = [ | |
'name' => null, | |
'email' => null, | |
'message' => null, | |
]; | |
if (!empty($_POST)) { | |
if (!isset($_POST['name'])) { | |
$errors['name'] = 'Your name is required'; | |
} elseif (strlen($_POST['name']) > 100) { |
NewerOlder