Skip to content

Instantly share code, notes, and snippets.

View v1.php
public function appendResponse(Response $response)
{
try {
$events = \json_try_decode($response->getBody(), true);
} catch (DecodeErrorException $e) {
$this->logger->emergency('Failed to decode response body as JSON', ['exception' => $e]);
throw new DecodingFailedException('Failed to decode response body as JSON', $e->getCode(), $e);
}
@PeeHaa
PeeHaa / GitAmptest.php
Created Jan 8, 2017
GitAmpTest with mocks
View GitAmptest.php
<?php declare(strict_types = 1);
namespace ekinhbayar\GitAmpTests\Client;
use Amp\Artax\Client;
use Amp\Artax\ClientException;
use Amp\Artax\Response;
use Amp\Promise;
use Amp\Success;
use ekinhbayar\GitAmp\Client\RequestFailedException;
View gist:e316e1e0248bc592ac0990c49525d115
E..
Time: 679 ms, Memory: 6.00MB
There was 1 error:
1) Amp\Dns\Test\IntegrationTest::testResolve
RuntimeException: Unknown error file getting key '\1'.
EXIT: 1
@PeeHaa
PeeHaa / so-golden
Created Jun 28, 2015
old army guy with 100 years of dev experience
View so-golden
I'm voting to close this question as off-topic because it has nothing to do with programming – PeeHaa 1 hour ago
Excuse me, but although I AM a programmer, for the past 35 YEARS, and a very experienced one at that, IT TAKES programming to figure this out. So, using apt-get update and apt-get INSTALL doesn't work to fix the problem. SO, excuse, me, but where else can I go to find a solution except the best place on the web for questions. NOT every question MUST deal with PROGRAMMING or perhaps, there "IS" a programming feature I NEED to do, through TERMINAL to "light up" the ethernet port. I AM 54 years old and need a solution. Instead of VOTING to destroy this question, how about we find a solution. – Peter 22 mins ago
BTW, we're ALL programmers here.... perhaps a bit of thinking together, vice VOTING my question OUT the window would be more of a prudent solution, don't you all think? We do that together in a real world work environment. How intelligent would it be if we simply told
@PeeHaa
PeeHaa / gist:3e7015617ee8cc32569d
Created Apr 1, 2015
ipv6 handling opcachegui
View gist:3e7015617ee8cc32569d
<?php
class IPv6Address
{
/**
* @var int[]
*/
private $words;
/**
View gist:370cb0940ac2efbcc41c
<?php
$song = new StdClass;
$song->artist = '" onmouseover="alert(\'all your base are belong to us\')" foo="';
?>
<form action="#">
<input type="text" name="xss" value="<?php if (isset($song->artist)) echo $song->artist; ?>">
</form>
View explain.php
<?php
echo "'$2a$08$KHiiru4yzYh141GUh2xIMew//bCc7rxMuY1rtDApwA66/czIiurLi'";
@PeeHaa
PeeHaa / routing-pitchblade.php
Last active Aug 29, 2015
Routing example PitchBlade
View routing-pitchblade.php
<?php
use PitchBlade\Storage\ImmutableArray;
use PitchBlade\Network\Http\Request;
use PitchBlade\Router\Path\SegmentFactory;
use PitchBlade\Router\Path\Factory as PathFactory;
use PitchBlade\Router\Route\Factory as RouteFactory;
use PitchBlade\Router\Router;
use PitchBlade\Router\NotFoundException;
use PitchBlade\Router\Route\AccessPoint;
@PeeHaa
PeeHaa / CustomEtsy.php
Created Dec 19, 2013
Etsy is being a dickhead with its non standard scope implementation. What a dick move
View CustomEtsy.php
<?php
use OAuth\OAuth1\Service\Etsy;
use OAuth\OAuth1\Signature\SignatureInterface;
use OAuth\Common\Consumer\CredentialsInterface;
use OAuth\Common\Http\Uri\UriInterface;
use OAuth\Common\Storage\TokenStorageInterface;
use OAuth\Common\Http\Client\ClientInterface;
class CustomEtsy extends Etsy
@PeeHaa
PeeHaa / mail-regex-tester.php
Created Aug 8, 2013
Emailaddress regex pattern tester
View mail-regex-tester.php
<?php
if (isset($_POST['submit'])) {
$html = file_get_contents('http://fightingforalostcause.net/misc/2006/compare-email-regex.php');
$dom = new DOMDocument();
@$dom->loadHTML($html);
//$results = $dom->getElementById('results');