Skip to content

Instantly share code, notes, and snippets.

View dkobia's full-sized avatar

David Kobia dkobia

View GitHub Profile
@dkobia
dkobia / gist:460098
Created July 1, 2010 15:18
Ushahidi Export Query
SELECT incident.id as "#", incident_title AS "INCIDENT TITLE", incident_date AS "INCIDENT DATE", location.location_name AS LOCATION, incident_description AS DESCRIPTION, category.category_title AS CATEGORY, location.latitude AS LATITUDE, location.longitude AS LONGITUDE, CASE WHEN incident_active = 1 THEN "YES" ELSE "NO" END AS APPROVED, CASE WHEN incident_verified = 1 THEN "YES" ELSE "NO" END AS VERIFIED
FROM incident INNER JOIN location ON incident.location_id = location.id LEFT JOIN incident_category ON incident.id = incident_category.incident_id LEFT JOIN category ON incident_category.category_id = category.id
GROUP BY incident.id
ORDER BY incident.id ASC;
@dkobia
dkobia / gist:490967
Created July 26, 2010 18:18
Ushahidi Clustering - Python
#!/usr/bin/env python
import math
import sys
import MySQLdb
MAP_ZOOM = 21
MAP_OFFSET = 268435456 # half the Earth's circumference at zoom level 21
MAP_RADIUS = MAP_OFFSET / math.pi
def longitude_to_x(longitude):
<?php
/**
* Map helper class
*
* Portions of this class credited to: zzolo, phayes, tmcw, brynbellomy, bdragon
*
* @package Map
* @author Ushahidi Team
* @copyright (c) 2008 Ushahidi Team
* @license http://www.ushahidi.com/license.html
{
"payload": {
"domain": "http:\/\/ushahidi.dev\/",
"incidents": [
{
"incident": {
"incidentid": "3494",
"incidenttitle": "National Palace damaged",
"incidentdescription": "National Palace has extensive damage. President and First Lady are safe.",
"incidentdate": "2010-01-12 10:43:00",
"categories": {
"24": "2B. PENURIE D'EAU | WATER SHORTAGE",
"44": "2A. PENURIE D'ALIMENTS | FOOD SHORTAGE"
}
{
"payload": {
"domain": "http:\/\/ushahidi.dev\/",
"incidents": [
{
"incident": {
"incidentid": "1",
"incidenttitle": "Hello Ushahidi!",
"incidentdescription": "Welcome to Ushahidi. Please replace this report with a valid incident",
"incidentdate": "2010-08-30 22:49:00",
{
"payload": {
"domain": "http:\/\/ushahidi.dev\/",
"incidents": [
{
"incident": {
"incidentid": "1",
"incidenttitle": "Hello Ushahidi!",
"incidentdescription": "Welcome to Ushahidi. Please replace this report with a valid incident",
"incidentdate": "2010-08-30 22:49:00",
ALTER TABLE `roles` ADD `reports_view` tinyint(4) NOT NULL default '0' AFTER `description`;
ALTER TABLE `roles` ADD `reports_edit` tinyint(4) NOT NULL default '0' AFTER `reports_view`;
ALTER TABLE `roles` ADD `reports_evaluation` tinyint(4) NOT NULL default '0' AFTER `reports_edit`;
ALTER TABLE `roles` ADD `reports_comments` tinyint(4) NOT NULL default '0' AFTER `reports_evaluation`;
ALTER TABLE `roles` ADD `reports_download` tinyint(4) NOT NULL default '0' AFTER `reports_comments`;
ALTER TABLE `roles` ADD `reports_upload` tinyint(4) NOT NULL default '0' AFTER `reports_download`;
ALTER TABLE `roles` ADD `messages` tinyint(4) NOT NULL default '0' AFTER `reports_upload`;
ALTER TABLE `roles` ADD `messages_reporters` tinyint(4) NOT NULL default '0' AFTER `messages`;
ALTER TABLE `roles` ADD `stats` tinyint(4) NOT NULL default '0' AFTER `messages_reporters`;
ALTER TABLE `roles` ADD `settings` tinyint(4) NOT NULL default '0' AFTER `stats`;
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Clickatell HTTP GET Controller
* Acts as the HTTP callback for Clickatell
*
* 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 <team@ushahidi.com>
@dkobia
dkobia / git-ftp.py
Created October 13, 2010 14:47
git-ftp.py
#!/usr/bin/env python
"""
git-ftp: painless, quick and easy working copy syncing over FTP
Copyright (c) 2008-2009
Edward Z. Yang <ezyang@mit.edu> and Mauro Lizaur <mauro@cacavoladora.org>
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation