Skip to content

Instantly share code, notes, and snippets.

View leonrenkema's full-sized avatar
🐁

Leon leonrenkema

🐁
View GitHub Profile

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

__author__ = 'leonrenkema'
from urllib import request
from http.client import HTTPException
from json import loads
from os import system
from os.path import isdir
class GitHubApi():
def get_repositories(self, page):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.api.seoeffect.com/">
<soapenv:Header/>
<soapenv:Body>
</soapenv:Body>
</soapenv:Envelope>
<?php
require_once('vendor/autoload.php');
$app = new Silex\Application();
$app->get('/person/{id}', function ($id) use ($app) {
$result = [
'name' => 'Person Name'
];
return $app->json($result);
});
<?php
function plus(int $a, int $b) : int {
}
<?php
namespace Drupal\hello\Plugin\Block;
use Drupal\Core\Block\BlockBase;
/**
* Class HelloBlock
* @package Drupal\hello\Plugin\Block
*
* @Block(
<?php
abstract class CacheDriver {
private static $instance = NULL;
public static function getInstance()
{
$classname = get_called_class();
if (self::$instance != NULL) return self::$instance;
self::$instance = new $classname();
@leonrenkema
leonrenkema / AppEngine.php
Created July 5, 2015 20:28
Override of the default Filesystem loader for twig to be used on Google Appengine.
<?php
/**
* Override of the default Filesystem loader for twig to be used on Google Appengine.
* Appengine cannot write to the disk so all templates must be precompiled and the
* file id must stay the same.
*
* See https://www.leonrenkema.nl/2015/07/05/php-on-app-engine/
*/
class Twig_Loader_AppEngine extends Twig_Loader_Filesystem
<?php
function parseCSV($csvData) {
$result = [];
$rows = explode("\n", $csvData);
foreach ($rows as $key => $row) {
$cols = explode(";", $row);
$result[] = $cols;
}
return $result;