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
// MySQL | |
$sql = "SELECT all, the fields, you, want, ((ACOS(SIN(c.Latitude * PI() / 180) * SIN(" . $lat . " * PI() / 180) + COS(c.Latitude * PI() / 180) * COS(" . $lat . " * PI() / 180) * COS((c.Longitude - " . $lng . ") * PI() / 180)) * 180 / PI()) * 60 * 2) as distance FROM places ORDER BY distance DESC;"; | |
// MongoDB | |
$this->places->find(array( 'loc' => array( '$near' => array($lat, $lng) ) )); |
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
var model = { | |
'/animals': { | |
'verb': "get", | |
'template': '<div id="animal-{{ID}}"> \ | |
<a href="#/animals/{{ID}}"><h2>{{title}}</h2></a> \ | |
<h3>{{time_added}}</h3> \ | |
<img src="{{thumbnail.0}}" /></div>' | |
}, | |
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 | |
/* | |
Plugin Name: Facebook Event | |
Plugin URI: http://www.studentlund.se | |
Description: Detect Facebook event URL in post and update post content to match the event | |
Author: Niklas Lindblad | |
Version: 0.1 | |
Author URI: http://niklas.lindblad.info | |
*/ |
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 | |
function is_facebook_event( $url ) | |
{ | |
return ( preg_match("/http:\/\/www\.facebook\.com\/event.php\?eid=[0-9]*\.*/", $url) == 1 ); | |
} | |
function get_facebook_event ( $url ) | |
{ | |
$m = explode('=', $url); |
NewerOlder