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 | |
header('Content-type: application/json'); | |
// Based on http://www.ravelrumba.com/blog/json-google-spreadsheets/ | |
//######################################################### | |
$key = ''; | |
$gid = '0'; //the sheet of the spreadsheet | |
//######################################################### |
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
SELECT a.name as term_name, wp_term_taxonomy.term_id | |
FROM wp_term_taxonomy | |
JOIN | |
wp_terms a | |
ON (wp_term_taxonomy.term_id = a.term_id) | |
LEFT JOIN | |
wp_terms b | |
ON (wp_term_taxonomy.parent = b.term_id) | |
WHERE wp_term_taxonomy.taxonomy = 'newscategory' | |
GROUP BY wp_term_taxonomy.term_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
'meta_key' => '_thumbnail_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
$args = array( | |
'post_type'=>'event', | |
'numberposts'=>-1, | |
'post_status'=>'publish', | |
'no_found_rows'=>true, | |
'meta_query'=>array( | |
array( | |
'key'=>'date', | |
'value'=>date('Y-m-d'), | |
'compare'=>'>=' |
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
function get_facebook_likes(){ | |
//based on http://halgatewood.com/get-number-of-facebook-likes-for-a-url/ | |
$query = "select total_count,like_count,comment_count,share_count,click_count from link_stat where url='{$uri}'"; | |
$call = "https://api.facebook.com/method/fql.query?query=" . rawurlencode($query) . "&format=json"; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $call); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
$output = curl_exec($ch); |
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 | |
$files = array(); | |
if ($handle = opendir('.')): | |
while (false !== ($entry = readdir($handle))): | |
if ( !empty($entry) && $entry != "." && $entry != ".." && $entry != "" && $entry != 'index.php'): | |
$files[] = $entry; | |
endif; | |
endwhile; | |
closedir($handle); | |
endif; |
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 | |
echo '<ul>'; | |
if ($handle = opendir('.')) { | |
while (false !== ($entry = readdir($handle))) { | |
if ( !empty($entry) && $entry != "." && $entry != ".." && $entry != "" && $entry != 'index.php') { | |
echo '<li><a href="'.$entry.'">'.$entry.'</a></li>'.PHP_EOL; | |
} | |
} | |
closedir($handle); | |
} |
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
//stupid IE & mobile safari | |
if (typeof(console) === 'undefined') { | |
console = { | |
log : function(data){}, | |
table : function(data){} | |
}; | |
} |
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 | |
mysql_connect("localhost", "root", ""); | |
mysql_select_db("coins"); | |
$result = mysql_query("select * from coins"); | |
$list = array(); | |
while ($r = mysql_fetch_object($result)) { | |
$list[$r->society][] = $r->ID; | |
} | |
print_r(json_encode($list)); |