Skip to content

Instantly share code, notes, and snippets.

View brianherbert's full-sized avatar
🎯
Focusing

Brian Herbert brianherbert

🎯
Focusing
View GitHub Profile
function geo_success(loc) {
$("#location_status").html('Location Found: '+loc.coords.latitude+','+loc.coords.longitude);
$("#lat").val(loc.coords.latitude);
$("#lon").val(loc.coords.longitude);
}
function geo_error() {
$("#location_status").html('Sorry, location search failed. Please try again.');
}
@brianherbert
brianherbert / daysago.php
Created January 18, 2011 21:28
This is a function that returns a string stating the amount of time has passed from one timestamp to another.
<?php
function daysago($now,$then){
$daycount = floor(($now-$then)/86400); //86400 seconds in a day
$hourcount = floor(($now-$then)/3600); //3600 seconds in an hour
$minutecount = floor(($now-$then)/60); //60 seconds in a minute
if($daycount == 0) {
$str = 'Created ';
if($hourcount != 0) {
$str .= $hourcount.' ';
if($hourcount == 1) {
@brianherbert
brianherbert / colormixer.php
Created December 8, 2010 20:05
This script takes two hex values and produces the average color.
<?php
$hex1 = 'FF0000';
$hex2 = '0000FF';
$hex3 = '';
$r1 = base_convert($hex1{0}.$hex1{1},16,10);
$g1 = base_convert($hex1{2}.$hex1{3},16,10);
$b1 = base_convert($hex1{4}.$hex1{5},16,10);
$r2 = base_convert($hex2{0}.$hex2{1},16,10);
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Array of subdomains you would like to prevent MHI users from using.
*
*/
$config['blocked_subdomains'] = array(
// Team Member Names
<?php
/**
* Messages view page.
*
* PHP version 5
* LICENSE: This source file is subject to LGPL license
* that is available through the world-wide-web at the following URI:
* http://www.gnu.org/copyleft/lesser.html
* @author Ushahidi Team <[email protected]>
* @package Ushahidi - http://source.ushahididev.com
@brianherbert
brianherbert / index.php
Created June 29, 2010 18:44
Simple Name Generator
<?php
require 'name_generator.php';
echo 'Random Name: '.name('boy');
?>