Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Tsai yidas

View GitHub Profile
@jaxbot
jaxbot / gist:5748513
Created Jun 10, 2013
Block nginx from serving .git directories
View gist:5748513
location ~ /\.git {
deny all;
}
# or, all . directories/files in general (including .htaccess, etc)
location ~ /\. {
deny all;
}
@victorbstan
victorbstan / php_object_to_array.php
Created Dec 17, 2010
recursively cast a PHP object to array
View php_object_to_array.php
<?php
/*
This function saved my life.
found on: http://www.sitepoint.com/forums//showthread.php?t=438748
by: crvandyke
It takes an object, and when all else if/else/recursive functions fail to convert the object into an associative array, this one goes for the kill. Who would'a thunk it?!
*/
$array = json_decode(json_encode($object), true);