Skip to content

Instantly share code, notes, and snippets.

View codepo8's full-sized avatar

Christian Heilmann codepo8

View GitHub Profile
<?php
$yql_url = 'http://query.yahooapis.com/v1/public/yql?';
$query = 'SELECT * FROM flickr.photos.search WHERE has_geo="true" AND text="san francisco"';
$query_url = $yql_url . 'q=' . urlencode($query) . '&format=xml';
$photos = simplexml_load_file($query_url);
$result = build_photos($photos->results->photo);
echo $result;
function build_photos($photos){
<?php error_reporting(0);?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Craigslist Date Filter</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/combo?2.8.0/build/reset-fonts-grids/reset-fonts-grids.css">
<style type="text/css">
body,html{background:#999;color:#000;}
#doc{background:#fff;border:1em solid #fff;}
default xml namespace = "http://where.yahooapis.com/v1/schema.rng";
var res = y.query("select * from geo.places(1) where text='"+
place + "'").results;
var lat = res.place.centroid.latitude;
var lon = res.place.centroid.longitude;
lat = Math.round(parseInt(lat)/5)*5;
lon = Math.round(parseInt(lon)/5)*5;
if(lat === +lat){
var src='http://earthquake.usgs.gov/images/globes/'+
/*
Globebadge by Christian Heilmann
http://isithackday.com/hacks/geo/globes/
Copyright (c)2010 Christian Heilmann
Code licensed under the BSD License:
http://wait-till-i.com/license.txt
*/
globebadge = function(){
var elm;
function init(o){
/*
World Info by Christian Heilmann
Homepage: http://github.com/codepo8/worldinfo
Copyright (c)2010 Christian Heilmann
Code licensed under the BSD License:
http://wait-till-i.com/license.txt
*/
$(document).ready(function(){
// define messages and "global variables"
@codepo8
codepo8 / localstorage.js
Created August 25, 2010 14:44
Store the state of a rendered form the easy way
<script>
// test for localStorage support
if(('localStorage' in window) && window['localStorage'] !== null){
var f = document.getElementById('mainform');
// test with PHP if the form was sent (the submit button has the name "sent")
<?php if(isset($_POST['sent']))){?>
// get the HTML of the form and cache it in the property "state"
localStorage.setItem('state',f.innerHTML);
(function () {
try {
if (!google.doodle) google.doodle = {};
var a = 200,
g = -200,
j = -200,
k, l, m, n = 0,
o = 0,
p = 0,
q = 35,
.circle{
-moz-border-radius:160px;
-webkit-border-radius:160px;
-khtml-border-radius:160px;
border-radius:160px
}
lanyrdbadge = function(){
var l;
function init(){
l = document.getElementById('lanyrd');
if(l && l.nodeName.toLowerCase() === 'a'){
l.innerHTML += ' <span>(Loading&hellip)</span>';
var user = l.getAttribute('href');
var url = 'http://query.yahooapis.com/v1/public/yql?'+
'q=select%20*%20from%20html%20where%20url%3D%22'+
encodeURIComponent(user)+
div#lanyrd{
background:#eef;
border:1px solid #999;
padding:5px;
-moz-border-radius:5px;
-wekbit-border-radius:5px;
border-radius:5px;
width:20em;
}
#lanyrd a{color:#000;}