Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@PeeHaa
PeeHaa / v1.php
Created June 29, 2017 14:53
v1 vs v2
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 January 8, 2017 12:28
GitAmpTest with mocks
<?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;
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 June 28, 2015 19:38
old army guy with 100 years of dev experience
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 April 1, 2015 12:01
ipv6 handling opcachegui
<?php
class IPv6Address
{
/**
* @var int[]
*/
private $words;
/**
<?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>
<?php
echo "'$2a$08$KHiiru4yzYh141GUh2xIMew//bCc7rxMuY1rtDApwA66/czIiurLi'";
@PeeHaa
PeeHaa / routing-pitchblade.php
Last active August 29, 2015 14:00
Routing example PitchBlade
<?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 December 19, 2013 18:01
Etsy is being a dickhead with its non standard scope implementation. What a dick move
<?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 August 8, 2013 10:12
Emailaddress regex pattern tester
<?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');