Skip to content

Instantly share code, notes, and snippets.

View dhrrgn's full-sized avatar
🦙

Dan Horrigan dhrrgn

🦙
  • OH, USA
  • 21:10 (UTC -04:00)
View GitHub Profile
# Stuff up here
frontend incoming
acl secure dst_port 443
acl foo_host hdr(host) -i foo.com
redirect scheme https if foo_host !secure
# Stuff down here
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), 'vendor'))
from tornado.wsgi import WSGIContainer
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from assurance import frontend
def runserver():
@dhrrgn
dhrrgn / Request.php
Created September 3, 2014 13:40
Symfony Request Extension
<?php
namespace Core\Http;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
use Symfony\Component\HttpFoundation\ParameterBag;
class Request extends SymfonyRequest
{
/**
<?php
$file = new Core\File\RemoteFile('http://bestclipartblog.com/clipart-pics/food-clip-art-6.png');
// Check if exists:
var_dump($file->exists());// bool(true)
// Get HTTP Status Code
var_dump($file->getHttpStatus()); // int(200)
@dhrrgn
dhrrgn / MySQLiProxy.php
Created August 15, 2014 15:28
A MySQLi Proxy with Query logging.
<?php
namespace Core\Database;
use Logger;
use mysqli;
use Psr\Log\LoggerInterface;
/**
* Class MySQLiProxy
<?php
class Currency {
private $value = 0;
public function setValue($value)
{
$this->value = $value;
}
@dhrrgn
dhrrgn / function.php
Created May 19, 2014 16:30
Function for determining if a request is a Pjax request.
<?php
function is_pjax()
{
return array_key_exists('HTTP_X_PJAX', $_SERVER) || array_key_exists('_pjax', $_GET);
}
@dhrrgn
dhrrgn / DataContainer.php
Last active December 21, 2020 02:30
Data Container Class and Trait
<?php
use ArrayAccess;
use Countable;
use IteratorAggregate;
class DataContainer implements ArrayAccess, Countable, IteratorAggregate
{
use DataContainerTrait;
}
@dhrrgn
dhrrgn / JsonResponder.php
Last active August 29, 2015 14:01
A WIP implementation of the Responder Layer of Paul Jones' ADR Pattern: https://github.com/pmjones/mvc-refinement
<?php
namespace Core\Responder;
class JsonResponder extends Responder
{
/**
* @return \Orno\Http\Response
*/
protected function respond()
<?php
function require_in_context($__path, array $__context)
{
extract($__context, EXTR_SKIP);
unset($__context);
ob_start();
require $__path;