Skip to content

Instantly share code, notes, and snippets.

View tuupola's full-sized avatar

Mika Tuupola tuupola

View GitHub Profile
<?php
require __DIR__ . "/vendor/autoload.php";
use Http\Client\Curl\Client;
use Http\Message\MessageFactory\DiactorosMessageFactory;
use Http\Message\StreamFactory\DiactorosStreamFactory;
use Http\Discovery\HttpAsyncClientDiscovery;
use Http\Discovery\HttpClientDiscovery;
use Psr\Http\Message\ResponseInterface;

Keybase proof

I hereby claim:

  • I am tuupola on github.
  • I am tuupola (https://keybase.io/tuupola) on keybase.
  • I have a public key ASDd8KUHc2ysqd2rplSt3onYRIq3UJ8zqnnADb2dg0KWlgo

To claim this, I am signing this object:

@tuupola
tuupola / index.php
Created June 10, 2016 08:44
CORS middleware with Zend Expressive
<?php
use Zend\Expressive\AppFactory;
require __DIR__ . "/../vendor/autoload.php;
$app = AppFactory::create();
$app->pipe(new \Tuupola\Middleware\Cors([
"origin" => ["*"],
@tuupola
tuupola / index.php
Last active March 4, 2019 09:47
Use JWT Authentication middleware with ZF Expressive
<?php
use Zend\Expressive\AppFactory;
use Firebase\JWT\JWT;
use Slim\Middleware\JwtAuthentication;
chdir(dirname(__DIR__));
require "vendor/autoload.php";
$app = AppFactory::create();
@tuupola
tuupola / index.php
Created April 18, 2015 14:03
Sample JWT workflow with HTTP Basic Auth
<?php
use \Slim\Middleware\JwtAuthentication;
use \Slim\Middleware\JwtAuthentication\RequestPathRule;
use \Slim\Middleware\HttpBasicAuthentication;
/* Setup Slim */
$app = new \Slim\Slim();
$app->add(new JwtAuthentication([
@tuupola
tuupola / MonologSQLLogger.php
Last active June 12, 2017 04:33
Monolog logging with Spot2 and Slim
<?php
/* This is old, use https://github.com/tuupola/dbal-psr3-logger instead. */
namespace Doctrine\DBAL\Logging;
class MonologSQLLogger implements SQLLogger {
public $logger;
public $sql = "";
@tuupola
tuupola / links.html
Last active December 21, 2015 20:59
Example on how to do Google Event tracking.
@tuupola
tuupola / .htaccess
Created December 12, 2012 10:34
Force https in .htaccess
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
@tuupola
tuupola / invite.js
Created November 7, 2012 13:39
Facebook share and message
$("#invite").bind("click", function(event) {
var invitation = {
method: "send",
name: "Lorem ipsum dolor sit amet",
link: "http://www.example.com/",
picture: "http://placekitten.com/95/95",
//to: next_uid,
description: "Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem."
};
@tuupola
tuupola / gist:3877855
Created October 12, 2012 07:53
Fix for. Centos screen No more PTYs. Sorry could not find PTY.
sudo mount -t devpts /dev/ptmx /dev/pts