Skip to content

Instantly share code, notes, and snippets.

View Camwyn's full-sized avatar
🐫
yup

Stephen Page Camwyn

🐫
yup
  • Camwyn & Co
  • Burke, NY
  • 03:00 (UTC -04:00)
View GitHub Profile
@Camwyn
Camwyn / Looping.php
Created April 16, 2014 14:10
Test for multi-dimensional array search optimization
<?php
$loops = 1000000;
$index_array = array(
'Mr. Giggles' => 'first',
'Lucky Pete' => 'second',
'door' => 'third',
'bar' => 'fourth',
'Marius' => 'fifth',
);
$array = array(
#!/bin/pseudo-bash
# Read through this and modify to taste.
# Tested on:
# dataset_uuid: c36a3d28-80c2-11e1-9ec6-df5bd8b43f76
# sdc:sdc:smartosplus:3.2.0
mkdir /data
useradd -d /data dev
groupadd dev
cd /data

Goal: To take this: https://graph.facebook.com/105464892820215 And derive this: America/Los Angeles From which we can then derive UTC-0800 or UTC-0700, as appropriate under the daylight madness scheme in effect on the date of interest.

It seems oddly hard to figure out what timezone a given point in space is located in. Looking around, there are only a few APIs which provide this information (http://www.earthtools.org/webservices.htm#timezone and http://www.worldweatheronline.com/time-zone-api.aspx), and only a few datasets which seem to contain it; most of them are in serious GIS formats, and expect you to query them in some manual fashion using a proprietary GIS tool.

I'm not really interested in that; I want a piece of code I can just ask "what timezone is this in" and get an answer, without installing some huge piece of software I don't have a license to or worrying about rate limits from somebody's API. So I'm going to take a shapefile I found here (http://efele.net/maps/tz/world/) and see if we can