Skip to content

Instantly share code, notes, and snippets.

@nickyleach
nickyleach / find_category.php
Created December 10, 2010 01:43
Simple example of parsing Yelps category structure to dereference an ID
<?
function find_category($id, $categories){
if(!count($categories)) return false;
foreach($categories as $set){
if($set['id'] == $id) return $set['t'];
$category = find_category($id, $set['c']);
if($category) break;
}
@nickyleach
nickyleach / gist:724230
Created December 1, 2010 21:09
Bookmarklet to convert to unixtime
javascript:ds = prompt("Date string:"); date = new Date(ds); alert(date.getTime()/1000);
@nickyleach
nickyleach / gist:724227
Created December 1, 2010 21:08
Bookmarklet to convert from unixtime
javascript:ts = prompt("Unix timestamp:"); date = new Date(ts*1000); alert(date.toUTCString());