Skip to content

Instantly share code, notes, and snippets.

hakre hakre

View GitHub Profile
View README.md

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.

View microbench.php
<?php
error_reporting(E_ALL);
function xrange($start, $end, $step = 1) {
for ($i = $start; $i < $end; $i += $step) {
yield $i;
}
}
@hakre
hakre / tutorial-function.md
Created Aug 8, 2012 — forked from PeeHaa/tutorial-function.md
function for tutorial
View tutorial-function.md

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.

@hakre
hakre / gist:3184468
Created Jul 26, 2012 — forked from rlemon/gist:3183650
Gitnologist
View gist:3184468
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 / specificity.php
Created May 18, 2012 — forked from absfarah/specificity.php
CSS sepcificty
View specificity.php
<?php
/**
* CSS sepcificty
*
* @link http://stackoverflow.com/questions/10636340/order-css-based-on-selector-specificity
* @return int
*/
function specificity($selector)
{
// Pseudo classes
@hakre
hakre / xpath_match_all
Created Feb 21, 2012 — 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
View xpath_match_all
<?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;
View is_serialized.php
<?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.
*/
/**
View special-background.php
<?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/
You can’t perform that action at this time.