Skip to content

Instantly share code, notes, and snippets.

@hannesvdvreken
hannesvdvreken / ImmutableContainer.php
Created August 21, 2015 14:23
Immutable container interface
<?php
interface ImmutableContainer
{
/**
* @param string $key
* @param callable $resolver
*
* @return static
*/
@hannesvdvreken
hannesvdvreken / foo.php
Created August 21, 2015 12:32
Return types
<?php
class Importer
{
/**
* @return $this
*/
public function setBaseUrl($url)
{
$this->baseUrl = $url;
@hannesvdvreken
hannesvdvreken / finishers.txt
Created August 17, 2015 08:54
Dodentocht 2015 - first 45 finishers
07:00 - 4498 - Yannick Vanceulebroeck
07:01 - 107 - Steven Gerard De Vlieger
07:01 - 10943 - Paul Mertens
07:01 - 4395 - Wim Spiessens
07:02 - 3911 - Christian Clauwaert
07:02 - 4376 - Bart Van Nijlen
07:02 - 9660 - Ivo Cesar Steyaert
07:03 - 1647 - Jan Vandekerckhove
07:03 - 189 - Martino Corneillie
07:03 - 6961 - stef nullens
@hannesvdvreken
hannesvdvreken / example.php
Created July 31, 2015 15:07
How to use Http\Adapter\Client
$client = new \Http\Adapter\Client($adapter);
$psrResponse = $client->get('https://api.github.com/users/hannesvdvreken');
@hannesvdvreken
hannesvdvreken / HttpAdapter.php
Created July 31, 2015 15:06
HttpAdapter::sendRequest method
/**
* Sends a PSR request
*
* @param \Psr\Http\Message\RequestInterface $request
* @param array $options
*
* @return \Psr\Http\Message\ResponseInterface
*/
public function sendRequest(RequestInterface $request, array $options = []);
composer config github-oauth.github.com ${GH_TOKEN}
Hi {{ first_name }},
We're sorry to inform you that we didn't select one of your proposal(s) to speak at {{ conference }}.
Here's a discount coupon, though: [XYXYXY](https://tickets.someconf.com/buy?coupon=XYXYXY)
Hope to see you at {{ conference }} in {{ month }}!
Cheers,
John Doe
$context = stream_context_create([], ['notification' => $callback]);
$resource = fopen($source, 'r', null, $context);
<?php
namespace Demo;
use League\Flysystem\Filesystem;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\ProgressBar;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
$client = new Guzzle\Http\Client();
$client->setBaseUrl('https://www.googleapis.com/analytics/v3/management');
foreach ($accounts as $account) {
$endpoint = "accounts/{$account->id}/webproperties";
$requests[] = $client->get($endpoint);
}
$responses = $client->send($request);