This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Dump XML (DOMNode) as Tree. | |
* | |
* @link http://stackoverflow.com/q/684227/367456 | |
*/ | |
abstract class IteratorDecoratorStub implements OuterIterator | |
{ | |
private $iterator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function whois($domain) { | |
// fix the domain name: | |
$domain = strtolower(trim($domain)); | |
$domain = preg_replace('/^http:\/\//i', '', $domain); | |
$domain = preg_replace('/^https:\/\//i', '', $domain); | |
$domain = preg_replace('/^www\./i', '', $domain); | |
$domain = explode('/', $domain); | |
$domain = trim($domain[0]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'ioc.php'; | |
class Material { | |
private $materialName = null; | |
public function __construct() { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Database Base Model class | |
*/ | |
class Model { | |
// Hold raw properties for save() which take precedence over regular properties | |
// used in combination with set_raw() as in set_raw('somefield', 'CURDATE()') | |
// Will allow you to pass in raw SQL, so use with caution |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// Quicksilver Score | |
// | |
// A port of the Quicksilver string ranking algorithm | |
// (re-ported from Javascript to PHP by Kenzie Campbell) | |
// http://route19.com/logbook/view/quicksilver-score-in-php | |
// | |
// score("hello world","axl") //=> 0.0 | |
// score("hello world","ow") //=> 0.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Github v3 API and OAuth classes | |
*/ | |
class GitHubAuth | |
{ | |
const AUTH_URL = 'https://github.com/login/oauth/authorize'; | |
const ACCESS_TOKEN_URL = 'https://github.com/login/oauth/access_token'; | |
private $app_id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class RecursiveDOMIterator extends RecursiveArrayIterator { | |
public function __construct($node) { | |
parent::__construct(iterator_to_array($node->childNodes)); | |
} | |
public function getChildren() { | |
return new self($this->current()); | |
} | |
public function hasChildren() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
/* | |
Version 0.2 | |
License This code is released under the MIT Open Source License. Feel free to do whatever you want with it. | |
Author lostleon@gmail.com, http://www.lostleon.com/ | |
LastUpdate 05/28/2010 | |
*/ | |
class GoogleVoice | |
{ | |
public $username; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function parseRss($feedUrl) { | |
$result = array(); | |
// "@" is for error handling | |
$feed = @simplexml_load_file($feedUrl); | |
//atom | |
if (isset($feed->entry)) { | |
$result['title'] = (string)$feed->title; | |
$result['link'] = (string)$feed->link->attributes()->href; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This script will allow the export of complete user time-lines from the twitter | |
* service. It joins together all pages of status updates into one large XML block | |
* that can then be reformatted/processed with other tools. | |
* | |
* @since 10/13/08 | |
* | |
* @copyright Copyright © 2008, Adam Franco | |
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL) |