Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
<?php | |
// saveJSON: XML to JSON conversion/transformation | |
// The saveJSON method is implemented as a method of the example DOMDocumentExtended class, which | |
// extends DOMDocument. It will transform the currently loaded DOM into JSON using XSLT. Since | |
// there isn't a reliable automatic way of detecting if certain siblings nodes should be | |
// represented as arrays or not, a "forceArray" parameter can be passed to the saveJSON method. | |
// It should be noted that the forceArray functionality doesn't recognize namespaces. This is | |
// an easy enough fix, I just didn't need it at the time of writing (look for local-name() and |
<?php | |
/* by pablo at compuar dot com see http://php.net/manual/de/function.base64-encode.php | |
* | |
* | |
*/ | |
$string = 'Blah'; | |
$encoded = strtr(base64_encode(addslashes(gzcompress(serialize($string),9))), '+/=', '-_,'); | |
$string= unserialize(gzuncompress(stripslashes(base64_decode(strtr($encoded, '-_,', '+/='))))); |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Bjoerns URL Shortener</title> | |
<meta name="author" content="Bjoern Wagner"> | |
<!-- Le HTML5 shim, for IE6-8 support of HTML elements --> | |
<!--[if lt IE 9]> | |
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |
ShimLink = { | |
_hosts: { | |
your: 'your.host.com', | |
another: 'another.host.com', | |
www: 'www.host.com', | |
tld: 'host.com', | |
The list would not be updated for now. Don't write comments.
The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.
Because of GitHub search limitations, only 1000 first users according to amount of followers are included. If you are not in the list you don't have enough followers. See raw data and source code. Algorithm in pseudocode:
githubUsers
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript | |
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15); |
#define _XOPEN_SOURCE 700 | |
#include <signal.h> | |
#include <unistd.h> | |
int main() | |
{ | |
sigset_t set; | |
int status; | |
if (getpid() != 1) return 1; |
<?php | |
// DEFINE our cipher | |
define('AES_256_CBC', 'aes-256-cbc'); | |
// Generate a 256-bit encryption key | |
// This should be stored somewhere instead of recreating it each time | |
$encryption_key = openssl_random_pseudo_bytes(32); | |
// Generate an initialization vector | |
// This *MUST* be available for decryption as well |