Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Special Background Wordpress Plugin
*
* @-wp-header Plugin Name: Special Background
* @-wp-header Plugin URI: http://wordpress.stackexchange.com/questions/972/
* @-wp-header Description: Example to show how to add a special background using exiting background admin page in core.
* @-wp-header Version: 0.2
* @-wp-header Author: Mike Schinkel, hakre
* @-wp-header Author URI: http://mikeschinkel.com/custom-wordpress-plugins/
<?php
/**
* This program is free software. It comes without any warranty, to
* the extent permitted by applicable law. You can redistribute it
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://sam.zoy.org/wtfpl/COPYING for more details.
*/
/**
@hakre
hakre / xpath_match_all
Created February 21, 2012 22:28 — forked from gooh/xpath_match_all
function for people whining that preg_match_all is less to type and concluding from it that regex must be better for parsing html than a dom parser
<?php
/**
* @param string $query xpath query/expression
* @param string $html (optional)
* @return array|FALSE array on success, FALSE on error
*/
function xpath_match_all($query, $html = '')
{
static $dom;
static $xpath;
@hakre
hakre / specificity.php
Created May 18, 2012 10:15 — forked from absfarah/specificity.php
CSS sepcificty
<?php
/**
* CSS sepcificty
*
* @link http://stackoverflow.com/questions/10636340/order-css-based-on-selector-specificity
* @return int
*/
function specificity($selector)
{
// Pseudo classes
@hakre
hakre / gist:3184468
Created July 26, 2012 20:57 — forked from rlemon/gist:3183650
Gitnologist
Fork it, use it, break it, fix it,
Comm it, push it, pull - request it,
Fetch it, branch it, patch it, fake it,
Merge it, ssh it, never - https it.
Write it, cut it, paste it, save it,
Build it, check it, quick - rewrite it,
Clone it, crack it, crop it, comp it,
Drag and drop it, gzlib - gzip it.
@hakre
hakre / tutorial-function.md
Created August 8, 2012 16:01 — forked from PeeHaa/tutorial-function.md
function for tutorial

Functions

PHP already has a lot of [built-in functions][builtin-functions]. Besides the built-in functions already provided by PHP it is also possible to define your own functions. Functions are used to group code into something useful, it organizes your code.

Generally speaking a function is a piece of code with an input, some defined actions based on the input and an output and then an optional return value:

INPUT --> PROCESSING --> OUTPUT

A function therefore is a little program inside a larger program. It sometimes is called subroutine as well because of that.

<?php
error_reporting(E_ALL);
function xrange($start, $end, $step = 1) {
for ($i = $start; $i < $end; $i += $step) {
yield $i;
}
}

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.