Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* PHP XML to dynamic table
*
* @link http://stackoverflow.com/q/16997835/367456
*/
require('.../Iterator-Garden/src/autoload.php'); // for DecoratingIterator - use development branch
@hakre
hakre / magnet-links-bittorrent.php
Created March 1, 2012 13:13
Magnet links library for PHP
@hakre
hakre / README.md
Last active August 18, 2022 12:57
Iterators for PHP XMLReader for ease of parsing

Iterators for PHP XMLReader for Ease of Parsing

Change Log:

  • 0.1.12 maintenance release with fixes.

  • 0.1.11 maintenance release with fixes. added XMLReader::CDATA and XMLReader::WHITESPACE node support for XMLWritingIteration. added

@hakre
hakre / HiddenFilesAndFolderFilterIterator.php
Created April 20, 2014 11:18
Filter recursive directory traversal and file listing in PHP with RecursiveDirectoryIterator
<?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 / StreamNotifyPrinter.php
Last active March 4, 2022 17:23
StreamNotifyPrinter - Print out PHP Stream Notifications to target channel (default: STDERR).
<?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 / output-buffer-to-temp.php
Created December 19, 2012 23:58
Output buffer for large output to temporary file on disk (>2MB)
<?php
/*
* Output buffer for large output to temporary file on disk (>2MB)
*
* @link http://stackoverflow.com/questions/5446647/how-can-i-use-var-dump-output-buffering-without-memory-errors/
*/
/**
* Iterate over lines of a stream resource.
*
@hakre
hakre / block-category-delete-example.php
Created November 23, 2010 14:56
Wordpress Block Category Delete Example
<?php
/**
* Block deletion of certain categories by their ID.
*
* Copyright (C) 2010 hakre <http://hakre.wordpress.com/>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.

Extend from SoapClient Examples

Just a collection gist of some assorted example SOAPClients. Code must not be stable or useful under all circumstances, these are examples. Most of the code is outdated, so you won't need to use it any longer in production code. I've just collected and compiled this together out of interest, the information normally is scattered around.

If you need to a start with PHP's SOAPClient start with the PHP manual page of it and read through the comments as well. Double check with exisiting bug-reports if given as many things are fixed since a comment was left.

@hakre
hakre / mirc.php
Created April 26, 2012 09:12
Tokenizer Example of Mirc Color and Style (bold) Codes.
<?php
/**
* Tokenizer Example of Mirc Color and Style (bold) Codes.
*
* @link http://stackoverflow.com/q/10329443/367456
*/
$mirc = "\x034this text is red\x033this text is green\x03 \x02bold text\x02
\x034,3this text is red with a green background\x03";
@hakre
hakre / DomTree.php
Last active February 22, 2021 11:40
DomTree - Dump DomDocument based documents, suiting debugging needs
<?php
/**
* DomTree
*
* Dump DomDocument based documents, suiting debugging needs
*
* @author hakre <http://hakre.wordpress.com/>
* @link http://stackoverflow.com/questions/26321597/getting-price-from-amazon-with-xpath/26323824#26323824
* @link http://stackoverflow.com/questions/12108324/how-to-get-a-raw-from-a-domnodelist/12108732#12108732
* @link http://stackoverflow.com/questions/684227/debug-a-domdocument-object-in-php/8631974#8631974