Skip to content

Instantly share code, notes, and snippets.

View brianherbert's full-sized avatar
🎯
Focusing

Brian Herbert brianherbert

🎯
Focusing
View GitHub Profile
@brianherbert
brianherbert / isoconvert.php
Created January 27, 2012 07:46
Convert ISO 3166-1 alpha-2 to ISO 3166-1 alpha-3 Code Array
<?php
$iso_array = array(
'AD'=>'AND',
'AE'=>'ARE',
'AF'=>'AFG',
'AG'=>'ATG',
'AI'=>'AIA',
'AL'=>'ALB',
'AM'=>'ARM',
'AO'=>'AGO',
@brianherbert
brianherbert / iso_array.php
Created January 27, 2012 07:35
ISO 3166-1 alpha-3 PHP Array
<?php
$iso_array = array(
'ABW'=>'Aruba',
'AFG'=>'Afghanistan',
'AGO'=>'Angola',
'AIA'=>'Anguilla',
'ALA'=>'Åland Islands',
'ALB'=>'Albania',
'AND'=>'Andorra',
'ARE'=>'United Arab Emirates',
@brianherbert
brianherbert / firefirst.php
Created December 30, 2011 02:48
Trying to figure out how to make functions fire before the one that's called in a class.
<?php
class Example {
public $count;
function __construct()
{
$this->count = 0;
}
@brianherbert
brianherbert / version_response.json
Created October 13, 2011 12:43
JSON of version response including plugins
{"payload":{"domain":"http:\/\/localhost:8888\/ushahidi_brian\/","version":[{"version":"2.1"}],"checkins":1,"email":"","sms":null,"plugins":["crowdmapmsg","viddler"]},"error":{"code":"0","message":"No Error"}}
@brianherbert
brianherbert / viddler_hook.php
Created October 10, 2011 13:47
example upload file from ushahidi using viddler
<?php
$viddler = new ViddlerV2($this->api_key);
$user = $viddler->viddler_users_auth(array('user'=>$this->username, 'password'=>$this->password));
$filename = upload::save('incident_video_file');
$params = array(
'sessionid'=>$user['auth']['sessionid'],
'title'=>'thisisatest'.rand(0,9999),
'tags'=>'tag1,tag2,tag3',
'description'=>'desc here dude',
@brianherbert
brianherbert / bindings.php
Created October 4, 2011 12:27
Converting Ushahidi Deployment to Cloud Files CDN
<?php
/**
* This is the PHP Cloud Files API.
*
* <code>
* # Authenticate to Cloud Files. The default is to automatically try
* # to re-authenticate if an authentication token expires.
* #
* # NOTE: Some versions of cURL include an outdated certificate authority (CA)
* # file. This API ships with a newer version obtained directly from
@brianherbert
brianherbert / update.sh
Created August 23, 2011 08:37
bash script to update localization
#! /bin/sh
cd /dir_to/Ushahidi-Localizations/
/usr/bin/git pull origin master
cd /dir_to/Ushahidi-Localizations.wiki/
/usr/bin/git pull origin master
/usr/bin/php /dir_to/Ushahidi-Localizations.updater/update.php
@brianherbert
brianherbert / open311.php
Created July 29, 2011 07:08
This is an example skeleton hook file for the open311 plugin.
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Open311 Hook - Load All Events
*
* 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
$(document).ready(function(){
var ci_styles = new OpenLayers.StyleMap({
"default": new OpenLayers.Style({
pointRadius: "10", // sized according to type attribute
fillColor: "${fillcolor}",
strokeColor: "${strokecolor}",
strokeWidth: 2,
graphicZIndex: 1
},
@brianherbert
brianherbert / .htaccess
Created February 15, 2011 19:59
Standard Ushahidi htaccess
# Turn on URL rewriting only when mod rewrite is turn on
<IfModule mod_rewrite.c>
RewriteEngine On
# Installation directory
RewriteBase /ushahidi
# Protect application and system files from being viewed
RewriteRule ^(application|modules|system) - [F,L]