Skip to content

Instantly share code, notes, and snippets.

@nrabinowitz
Created August 6, 2011 04:19
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nrabinowitz/1129009 to your computer and use it in GitHub Desktop.
Save nrabinowitz/1129009 to your computer and use it in GitHub Desktop.
Mock PHP service for timemap.js progressive loading
<?
// get timestamps
$start = strtotime($_GET['start']);
$end = strtotime($_GET['end']);
$cb = $_GET['callback'];
// start data
echo "$cb([";
// make some fake data
for ($x=0; $x<20; $x++) {
if ($x) echo ',';
echo '{';
echo 'title:"Item '.$x.'",';
echo 'start:"'.date('Y-m-d\TH:i:sO', rand($start, $end)).'",';
echo 'point:{lat:'.(43.0 + 10*(float)rand()/(float)getrandmax())
.',lon:'.(11.0 + 10*(float)rand()/(float)getrandmax()).'}';
echo '}';
}
// end data
echo "])";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment