Skip to content

Instantly share code, notes, and snippets.

View beberlei's full-sized avatar
💯

Benjamin Eberlei beberlei

💯
View GitHub Profile
@beberlei
beberlei / migrate_statuspage.php
Created November 20, 2021 23:20
Migrate from Laravel Cachet to Atlassian StatusPage.io
<?php
use Buzz\Browser;
use Buzz\Client\Curl;
require_once __DIR__ . '/vendor/autoload.php';
$statusPageApiKey = "";
$statusPageId = "";
$nextUrl = 'https://status.tideways.io/api/v1/incidents'; // Cachet API endpoint
@beberlei
beberlei / TaskLoggingMiddleware.php
Created August 23, 2021 10:36
Shopware 6 Canonical Log for Message Queue Tasks
<?php
namespace Shopware\Production\Messenger;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Exception\HandlerFailedException;
use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
use Symfony\Component\Messenger\Middleware\StackInterface;
use Shopware\Core\Framework\MessageQueue\ScheduledTask;
@beberlei
beberlei / .block
Last active August 28, 2018 15:02 — forked from mbostock/.block
Bar Chart
license: gpl-3.0
@beberlei
beberlei / phpunit_php7.patch
Last active August 29, 2015 14:16
PHPUnit necessary chanegs for PHP7 Coercive Typehints
diff --git a/src/Framework/TestSuite.php b/src/Framework/TestSuite.php
index 1b3b339..71ee4a9 100644
--- a/src/Framework/TestSuite.php
+++ b/src/Framework/TestSuite.php
@@ -878,7 +878,11 @@ public static function isTestMethod(ReflectionMethod $method)
// @scenario on TestCase::testMethod()
// @test on TestCase::testMethod()
- $doc_comment = $method->getDocComment();
+ $doc_comment = (string)$method->getDocComment();
$products = array();
foreach($arr['accounts'] as $val) {
$account_id = $val['account_id'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, 'https://api.appannie.com/v1.2/accounts/'.$account_id.'/sales?break_down=product&start_date=2015-01-01&end_date=2015-01-31');
<?php
$options = array(
'argument_functions' => array(
'file_get_contents',
'curl_exec',
'fgets',
'fputs',
'fread',
'fgetcsv',
@beberlei
beberlei / README.md
Last active December 21, 2015 04:38 — forked from proofek/watchr.rb

Dependency "watchr":

sudo gem install watchr

On Macs:

sudo gem install growl

Uses notify-send on other systems than Mac.

<?php
function datemanip(DateTime $dt)
{
return $dt->modify("+2 day");
}
$dt = new DateTime();
$dti = new DateTimeImmutable();
@beberlei
beberlei / pr.md
Created December 4, 2012 21:01 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@beberlei
beberlei / tailrecursion.php
Created November 25, 2012 21:25 — forked from pkriete/gist:2425817
PHP Tail Recursion
<?php
class TailRecursion
{
public $func;
public $acc;
public $recursing;
public function tail()
{
return call_user_func_array($this->func, func_get_args());