Skip to content

Instantly share code, notes, and snippets.

View trizz's full-sized avatar
🥃

Tristan trizz

🥃
View GitHub Profile

Keybase proof

I hereby claim:

  • I am trizz on github.
  • I am trizz (https://keybase.io/trizz) on keybase.
  • I have a public key ASCfOH7L6PpY47iz-GrTGujFLFcQuTfQ-1PJjocFxozRIwo

To claim this, I am signing this object:

<?php
namespace App;
use Exception;
use MessagePack\Packer;
use Redis;
class SocketIO
{
private $redis;
@trizz
trizz / ViewServiceProvider.php
Created May 6, 2015 06:55
Show a different Blade template based on permission. If 'private' then look for a template in the 'private' folder inside the original folder with the same name.
app('view')->creator('*', function (\Illuminate\Contracts\View\View $view) {
if(env('API_CLIENT_ID') === 'private') {
$viewValues = explode('/', $view->getPath());
$alreadyPrivate = ($viewValues[count($viewValues) - 2] === 'private');
$last = array_pop($viewValues);
array_push($viewValues, 'private', $last);
$privateView = implode('/', $viewValues);
@trizz
trizz / gist:9210998
Created February 25, 2014 15:24
Get a list of executed Laravel Illuminate queries
<?php
# Log de querys
foreach(DB::getQueryLog() AS $queryData) {
$query = $queryData['query'];
$pdo = DB::getPdo();
foreach($queryData['bindings'] as $binding) {
if(is_string($binding)) {
$query = preg_replace('/\?/', $pdo->quote($binding), $query, 1);
} else {
$query = $query."\n\nBinding: ".print_r($binding,1);
# Rewrite for content.
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
location ~* \.php$ {
@trizz
trizz / gist:5728600
Created June 7, 2013 11:16
Remove Munee cache dir
<?php
rmdir_recurse('../vendor/meenie/munee/cache');
function rmdir_recurse($path) {
$path = rtrim($path, '/').'/';
$handle = opendir($path);
while(false !== ($file = readdir($handle))) {
if($file != '.' and $file != '..' ) {
$fullpath = $path.$file;