Skip to content

Instantly share code, notes, and snippets.

hakre hakre

View GitHub Profile
@hakre
hakre / CurlDebug.php
Created Nov 2, 2014
curl debug drop-in class
View CurlDebug.php
<?php
/**
* Class CurlDebug
*
* drop-in class to add verbose information to curl requests and to display trouble-shooting information
*
* @author hakre <http://hakre.wordpress.com/>
* @link http://stackoverflow.com/a/14436877/367456
*/
class CurlDebug
@hakre
hakre / decode-input-stream-example.php
Last active Aug 29, 2015
Example: Decode an Input Stream with PHP filters
View decode-input-stream-example.php
<?php
/**
* Example: Decode an Input Stream with PHP filters
*
* decode-input-stream-example.php
*
* @link https://gist.github.com/hakre/d34239bb237c50e728fd
* @link http://stackoverflow.com/q/25051578/367456
*/
@hakre
hakre / StreamNotifyPrinter.php
Last active Jul 28, 2017
StreamNotifyPrinter - Print out PHP Stream Notifications to target channel (default: STDERR).
View StreamNotifyPrinter.php
<?php
/**
* StreamNotifyPrinter
*
* @author hakre <http://hakre.wordpress.com>
* @version 0.0.2
* @example http://stackoverflow.com/a/24711469/367456
* @link https://gist.github.com/hakre/8ba2c0d49b7baf062acd
*/
@hakre
hakre / HiddenFilesAndFolderFilterIterator.php
Created Apr 20, 2014
Filter recursive directory traversal and file listing in PHP with RecursiveDirectoryIterator
View HiddenFilesAndFolderFilterIterator.php
<?php
/**
* Class HiddenFilesAndFolderFilterIterator
*
* Under *Nix hidden files and directories start with a dot ("."). This RFI does not traverse
* hidden directories and filters hidden files from RecursiveDirectoryIterator listing.
*/
class HiddenFilesAndFolderFilterIterator extends RecursiveFilterIterator
{
@hakre
hakre / spl_autoload_register_psr0.php
Created Dec 26, 2013
spl_autoload_register() just with added PSR-0 support
View spl_autoload_register_psr0.php
<?php
/**
* spl_autoload_register() just with added PSR-0 support
*
* The support is added, that means, for each classname first of all
* by the priority given in the include-path directive, a per-directory
* test is done for the full-classname based file and then sub-directories
* are traversed.
*
* PHP 5.3 Namespace Separators are always mapped to a directory to
@hakre
hakre / RecursiveSimpleXMLIterator.php
Created Oct 31, 2013
RecursiveSimpleXMLIterator
View RecursiveSimpleXMLIterator.php
<?php
/**
* Class RecursiveSimpleXMLIterator
*
* RecursiveIterator for SimpleXMLElement
*/
class RecursiveSimpleXMLIterator extends IteratorIterator implements RecursiveIterator
{
function __construct(SimpleXMLElement $xml) {
parent::__construct($xml);
View php-zip-resource-types.md
@hakre
hakre / duri.php
Created Sep 30, 2013
duri - data:// URI based, non-javascript anonymous redirect script
View duri.php
<?php
/**
* duri - data:// URI based, non-javascript anonymous redirect script
*
* Redirects tested to ...
* ... work with:
* - Firefox (23.0.1)
* - Chrome (29.0.1547.76 m)
* - Google URL shortener <http://goo.gl/>
* ... not work with:
View XObjects.php
<?php
/**
* XObjects - XPath based Objects for SimpleXMLElement
*
* @author hakre <http://hakre.wordpress.com/credits/>
*/
/**
* Class XListIterator
*/
@hakre
hakre / uni-hamburg-guest-wlan.sh
Created Sep 21, 2013
Rough script to connect to Wlan Uni-Hamburg via wpa-supplicant in shell (no Internet Browser required)
View uni-hamburg-guest-wlan.sh
#!/bin/bash
#
# edit /etc/wpa_supplicant/wpa_supplicant.conf:
#
# network={
# ssid="GUEST"
# psk="rrz-wlan"
# }
#
echo "Connecting to WPA/WPA2 network uni-hamburg.de"
You can’t perform that action at this time.