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 | |
namespace Valet\Drivers\Custom; | |
use Valet\Drivers\BasicValetDriver; | |
/* | |
Valet driver for Wordpress Multisite | |
Usage: Drop this file into your ~/.valet/Drivers/ directory |
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 Item_handler { | |
public static function upload_one() { | |
// Do something expensive with lots of deps | |
return true; | |
} | |
public function upload_two() { | |
// Do something expensive with lots of deps |
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 | |
$secret = 'top_secret'; | |
$url = 'https://example.com/wa-hook/abc123abc123 | |
$parameters = ['foo' => 'bar']; | |
$args = ['headers' => []]; | |
$args['body'] = json_encode($parameters); | |
$hash = hash_hmac('sha1', $args['body'], $secret); | |
$args['headers']['Content-Type'] = 'application/json; charset=utf-8'; |
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
/******************************************************** | |
* | |
* Small script to display AMD GPU ordering in xmr-stak vs OverdriveNTool. | |
* | |
* To run this script, you first need to create a correctly named | |
* textfile with clinfo output. Use this command to create the file: | |
* | |
* C:\some\folder> clinfo | findstr "Device Topology" > clinfo_topology.txt | |
* | |
* TIP: Add the above command to your windows startup script, that way you |
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 | |
// Solution 1. Let ElectricCar handle unplugging itself | |
class ElectricCar extends Car | |
{ | |
... | |
public function start() | |
{ | |
$this->unplug(); | |
parent::start(); |
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 Driver | |
{ | |
private $car; | |
public function __construct($car) | |
{ | |
$this->car = $car; | |
} |
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 Car | |
{ | |
public function start() | |
{ | |
/// wrooom | |
} | |
} |
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 | |
public function testRegister() | |
{ | |
$container = new Pimple\Container(); | |
$provider = new RuntimeProvider(); | |
$provider->register($container); | |
$this->assertInstanceOf('helloTestable\Lyrics', $container['lyrics']); | |
$this->assertInstanceOf('helloTestable\helloTestable', $container['helloTestable']); |
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 | |
public function testEchoCss() | |
{ | |
\WP_Mock::userFunction('is_rtl', array( | |
'return_in_order' => array(true, false), | |
)); | |
$dummy = new \stdClass(); | |
$hello = new helloTestable($dummy); |
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 | |
public function testEchoLyric() | |
{ | |
$mockLyric = new \MockLyric('foobar'); | |
$hello = new helloTestable($mockLyric); | |
$this->expectOutputRegex('/.*foobar*./'); | |
$hello->echoLyric(); | |
} |
NewerOlder