This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// to be used in a class | |
function deprecateMethod() | |
{ | |
$traces = debug_backtrace(); | |
array_shift($traces); | |
$def = array('class' => null, 'type' => null, 'function' => null); | |
do { | |
$trace1 = array_shift($traces); | |
// dump($trace1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Doctrine\Common\Inflector\Inflector; | |
use Monolog\Logger; | |
use Silex\Application; | |
use Silex\ServiceProviderInterface; | |
use Symfony\Component\HttpKernel\Event\FilterControllerEvent; | |
use Symfony\Component\HttpKernel\KernelEvents; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Adminer 4.2.2 MySQL dump | |
SET NAMES utf8; | |
SET time_zone = '+00:00'; | |
SET foreign_key_checks = 0; | |
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; | |
DROP TABLE IF EXISTS `author`; | |
CREATE TABLE `author` ( | |
`id` tinyint(4) NOT NULL AUTO_INCREMENT, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Content-Type: text/csv'); | |
header(sprintf('Content-Disposition:attachment; filename="data_%s_%s.csv"', date(DATE_ISO8601), str_replace('www.', '', $_SERVER['HTTP_HOST']))); | |
$fh = fopen('php://output', 'w'); | |
$sep = ','; | |
$enc = '"'; | |
// excel needs sep to indicate what the seperator is. | |
fputcsv($fh, array('sep=', ''), $sep, $enc); | |
$first = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MyDb extends PDO { | |
use LazySingleton; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.video-wrapper { | |
width:100vw; | |
height:100vh; | |
position:relative; | |
video { | |
position: absolute; | |
top:0; | |
right:0; | |
bottom:0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try { | |
// render some code with twig_error_runtime | |
} catch (\Twig_Error_Runtime $e) { | |
$repl = array(realpath(dirname($_SERVER['SCRIPT_FILENAME'])) => '~'); | |
foreach ($e->getTrace() as $trace) { | |
if (!isset($trace['class'])) { | |
continue; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// write above part yourself! | |
ob_start(); | |
$ch = curl_init('http://api.resmush.it/ws.php'); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); | |
curl_setopt($ch, CURLOPT_POST, true); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, array('files' => '@' . $cache_path)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
use Doctrine\Common\Cache\FilesystemCache; | |
$dirs = array('_storage'); | |
while ($dir = array_pop($dirs)) { | |
if ($cache_files = glob($dir . '/*' . FilesystemCache::EXTENSION)) { | |
foreach ($cache_files as $cache_file) { | |
$delete = false; | |
if ($fh = fopen($cache_file, 'r')) { |