This file contains 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 | |
class MY_Controller extends CI_Controller { | |
function __construct () { | |
parent::__construct(); | |
if (!$this->ion_auth->logged_in()) |
This file contains 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 sanitize($string, $force_lowercase = true, $anal = false) { | |
$strip = array("~", "`", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "=", "+", "[", "{", "]", | |
"}", "\\", "|", ";", ":", "\"", "'", "‘", "’", "“", "”", "–", "—", | |
"—", "–", ",", "<", ".", ">", "/", "?"); | |
$clean = trim(str_replace($strip, "", strip_tags($string))); | |
$clean = preg_replace('/\s+/', "-", $clean); | |
$clean = ($anal) ? preg_replace("/[^a-zA-Z0-9]/", "", $clean) : $clean ; | |
return ($force_lowercase) ? |
This file contains 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 generate_string($length) { | |
$chars = "0123456789abcdefghijklmnopqrstuvwxyz"; | |
$string = ""; | |
for ($i = 0; $i < $length; $i++) { | |
$string .= $chars[mt_rand(0, strlen($chars) - 1)]; | |
} |
This file contains 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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<!-- Facebook sharing information tags --> | |
<meta property="og:title" content="*|MC:SUBJECT|*" /> | |
<title>Salusbury Rooms Newsletter #1</title> | |
<style type="text/css"> |
This file contains 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
## ALIASES | |
alias home='cd ~/' | |
alias ls='ls -ls -G' | |
alias webfaction='ssh web***.webfaction.com -l ************' | |
alias htdocs='cd /Applications/MAMP/htdocs' | |
## | |
CDPATH='.:~:/Applications/MAMP/htdocs' |
This file contains 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
## | |
# Host Database | |
# | |
# localhost is used to configure the loopback interface | |
# when the system is booting. Do not change this entry. | |
## | |
127.0.0.1 localhost | |
255.255.255.255 broadcasthost | |
::1 localhost | |
fe80::1%lo0 localhost |
This file contains 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
# Double check file structure before use | |
task 'build:coffee', 'build src/client.js file from source files', (options) -> | |
files = content = [] | |
finished = {} | |
fs.readFile 'src/client/coffee/base.coffee', 'utf8', (err, contents) -> | |
content.push contents | |
for dir in ['views', 'collections', 'models'] then do (dir) -> | |
delay = (ms, func) -> setTimeout func, ms | |
if dir is 'models' |
This file contains 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
distance = (lat1, lon1, lat2, lon2) -> | |
R = 6371 # km (change this constant to get miles) | |
dLat = (lat2 - lat1) * Math.PI / 180 | |
dLon = (lon2 - lon1) * Math.PI / 180 | |
a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) * Math.sin(dLon / 2) * Math.sin(dLon / 2) | |
c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)) | |
d = R * c | |
if d > 1 | |
return d + "km" | |
else return Math.round(d * 1000) + "m" if d <= 1 |
This file contains 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
Select *, | |
acos(sin($lat)*sin(radians(event_latitude)) + cos($lat)*cos(radians(event_latitude))*cos(radians(event_longitude)-$lon))*$R As distance | |
From ( | |
Select search_view.*, images.image_url | |
From search_view, images | |
Where search_view.event_image_id = images.image_id | |
AND event_start > ? | |
And event_latitude>$min_lat And event_latitude<$max_lat | |
And event_longitude>$min_lon And event_longitude<$max_lon | |
) As FirstCut |
OlderNewer