This file contains hidden or 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
-- Haversine Formula based geodistance in miles (constant is diameter of Earth in miles) | |
-- Based on a similar PostgreSQL function found here: https://gist.github.com/831833 | |
-- Updated to use distance formulas found here: http://www.codecodex.com/wiki/Calculate_distance_between_two_points_on_a_globe | |
CREATE OR REPLACE FUNCTION public.geodistance(alat double precision, alng double precision, blat double precision, blng double precision) | |
RETURNS double precision AS | |
$BODY$ | |
SELECT asin( | |
sqrt( | |
sin(radians($3-$1)/2)^2 + | |
sin(radians($4-$2)/2)^2 * |
This file contains hidden or 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 | |
$api = new DoodleAPI(); | |
$api->createPoll(array( | |
'title' => 'Test Poll', | |
'description' => 'Test Description', | |
'fromName' => 'David Patierno', | |
'fromEmail' => '[email protected]', | |
'dates' => array( |
This file contains hidden or 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 | |
/** | |
* this class shows how to override default PHP handler to catch undefined index errors | |
* and throw it as native exceptions, much more convenient way to work with object | |
* oriented programs. | |
* | |
* @author Moisés Maciá <[email protected]> | |
* @see http://codeup.net | |
*/ |
NewerOlder