This file contains hidden or 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 | |
/** | |
* PDO Wrapper Class | |
* @author Christopher A. Moore <[email protected]> | |
* | |
* @refs : | |
* http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/ | |
* @test | |
*/ |
This file contains hidden or 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 | |
/** | |
* Debug / Logger | |
* | |
* @author : christopher a. moore <[email protected]> | |
* @Usage : | |
* $log = new Log(); | |
* $log->debug = true; | |
* $log->msg('Initialize Debug Class'); |
This file contains hidden or 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
// ref: http://stackoverflow.com/questions/12654451/twitter-data-finding-the-most-mentioned-user-in-mongodb | |
// ref: http://stackoverflow.com/questions/12665866/mongodb-aggregating-array-items/12666156#comment17092191_12666156 | |
var count = 0; | |
db.COLLECTION.find({key: "value"},{key_to_count:1}).forEach( | |
function (doc) { | |
count += doc.key_to_count.length; | |
} | |
) | |
print("key_to_count: " + count); |
This file contains hidden or 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 | |
/** | |
* @author <Chris Moore> | |
* Config file sets all global options | |
* And Loads all Dependencies | |
* */ | |
/** | |
* @param environment = prod, dev , etc. .. |
This file contains hidden or 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 | |
/** | |
* Base Class | |
* Extends ChromPhp to allow for Rapid Debugging based on needs | |
*/ | |
class Base extends ChromePhp | |
{ | |
public function __construct() | |
{ |
This file contains hidden or 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
/** | |
* Converts a JS object to PHP object | |
**/ | |
function jsObj2phpObj(object){ | |
var json = '{'; | |
for(property in object){ | |
var value = object[property]; | |
if(typeof(value) == 'string'){ | |
json += '"' + property + '":"' + value + '",' | |
} else { |
This file contains hidden or 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 | |
echo "<pre>"; | |
$pattern = array(',"', '{', '}'); | |
$replacement = array(",\n\t\"", "{\n\t", "\n}"); | |
echo str_replace($pattern, $replacement, $data); |
This file contains hidden or 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 | |
/** | |
* Quova : http://developer.quova.com/ | |
* * | |
* Key Rate Limits | |
* 2 Calls per second | |
* 1,000 Calls per day | |
*/ | |
// initiate curl and set options | |
$ipin = '174.79.250.40'; // $_SERVER['REMOTE_ADDR']; |
This file contains hidden or 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 GetWeather($state,$country,$langauge,$waetherIcons){ | |
// auf der Basis von http://www.web-spirit.de/webdesign-tutorial/9/Wetter-auf-eigener-Website-mit-Google-Weather-API | |
$api = simplexml_load_string(utf8_encode(file_get_contents("http://www.google.com/ig/api?weather=".$state."-".$country."&hl=".$langauge))); | |
// $trans = array("ä" => "ä", "Ä" => "Ä", "ü" => "ü", "Ü" => "Ü", "ö" => "ö", "Ö" => "Ö", "ß" => "ß"); | |
$trans = array("ü" => "ü", "ö" => "ö", "ä" => "ä", "ß" => "ß"); | |
$weather = array(); | |
$i = 1; | |
foreach($api->weather->forecast_conditions as $GoogleWeather){ |
This file contains hidden or 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 | |
/* | |
URL text to linked HTML | |
Find text URLs in string and replaces with linked HTML URL. e.g. 'Please go to: http://www.OpenCrypt.com/' would become 'Please go to: http://www.OpenCrypt.com/' | |
Usage: | |
print url_string_to_html("Please go to: http://www.OpenCrypt.com/"); | |
Or: | |
$string = "Please go to: http://www.OpenCrypt.com/"; | |
print url_string_to_html($string); |