Skip to content

Instantly share code, notes, and snippets.

View Bujhm's full-sized avatar
🐢
I may be slow to respond.

Igor Bujhm

🐢
I may be slow to respond.
View GitHub Profile
@Bujhm
Bujhm / pattern singleton in PDO.php
Created April 5, 2011 00:15
paul dot maddox at gmail dot com 27-Aug-2009 12:54
I decided to create a singleton wrapper for PDO that ensures only one instance is ever used.
It uses PHP 5.3.0's __callStatic functionality to pass on statically called methods to PDO.
This means you can just call it statically from anywhere without having to initiate or define the object.
Usage examples:
<?php
DB::exec("DELETE FROM Blah");
@Bujhm
Bujhm / gzip.php
Created November 24, 2010 01:15
<?php // gzip.php v1.2 - read http://rm.pp.ru/?1.phpgzip // released on 2004-05-06, by Roman Mamedov<roman at rm.pp.ru> // license: do with this code whatever you want. ///// Configuration ////////////////// $PREFER_DEFLATE = false; // prefer
<?php
// gzip.php v1.2 - read http://rm.pp.ru/?1.phpgzip
// released on 2004-05-06, by Roman Mamedov<roman at rm.pp.ru>
// license: do with this code whatever you want.
///// Configuration //////////////////
$PREFER_DEFLATE = false; // prefer deflate over gzip when both are supported
$FORCE_COMPRESSION = false; // force compression even when client does not report support
//////////////////////////////////////