Skip to content

Instantly share code, notes, and snippets.

View jmwenda's full-sized avatar

Jude Mwenda jmwenda

View GitHub Profile
/*
Leaflet, a JavaScript library for mobile-friendly interactive maps. http://leafletjs.com
(c) 2010-2013, Vladimir Agafonkin
(c) 2010-2011, CloudMade
*/
(function (window, document, undefined) {
var oldL = window.L,
L = {};
L.version = '0.7.5';
/*
Leaflet, a JavaScript library for mobile-friendly interactive maps. http://leafletjs.com
(c) 2010-2013, Vladimir Agafonkin
(c) 2010-2011, CloudMade
*/
(function (window, document, undefined) {
var oldL = window.L,
L = {};
L.version = '0.7.3';
@jmwenda
jmwenda / gist:477b8ea5661df7bc08e5
Created September 10, 2015 16:15
Openlayers 3 WMTs
<!DOCTYPE html>
<html>
<head>
<title>WMTS example</title>
<script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="http://openlayers.org/en/v3.8.2/css/ol.css" type="text/css">
<script src="http://openlayers.org/en/v3.8.2/build/ol.js"></script>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
@jmwenda
jmwenda / gist:14d766c24a88fb1e6567
Created September 17, 2015 14:14
Geometry errors with ArcRest
http://map.arboretum.harvard.edu/ArcGIS/rest/services
owner = admin , url = http://map.arboretum.harvard.edu/ArcGIS/rest/services
<type 'exceptions.ValueError'>
Unconvertible to geometry
File "/Users/jmwenda/dev/geonode/geonode/services/management/commands/batchimportservices.py", line 64, in handle
service = _register_arcgis_url(url, None, None, None, owner=owner)
File "/Users/jmwenda/dev/geonode/geonode/services/views.py", line 815, in _register_arcgis_url
arcserver, name, services=[], owner=owner, parent=parent)
File "/Users/jmwenda/dev/geonode/geonode/services/views.py", line 953, in _process_arcgis_folder
if service.spatialReference.wkid in [102100, 3857, 900913]:
@jmwenda
jmwenda / gist:a91d9e0a6e61eea08b86
Created September 18, 2015 19:15
Setting Logging file
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
},
'simple': {
'format': '%(message)s',
},
@jmwenda
jmwenda / geonode-backup
Created October 27, 2011 02:47
GeoNode mirror scripts.
#!/bin/bash
# Backup script, meant to me run at the geonode mirror.
# Make sure to enable passwordless access from the mirror to the original site.
# Authors: Jude Mwenda, Ariel Nunez
# http://github.com/GFDRR
#NOTE: This tool requires pgsql_schema_diff.py to be installed first
# cd /usr/bin
# https://raw.github.com/gist/380278/140b133ea52e55e63ea2bfae9630e14f22c80ac9/pgsql_schema_diff.py
@jmwenda
jmwenda / geonode-bckup
Created November 7, 2011 20:35
GeoNode Script to Back up directory and files
#!/bin/bash
# Backup script, meant to me run at the geonode mirror.
# Make sure to enable passwordless access from the mirror to the original site.
# Authors: Jude Mwenda, Ariel Nunez
# http://github.com/GFDRR
#NOTE: This tool requires pgsql_schema_diff.py to be installed first
# cd /usr/bin
# https://raw.github.com/gist/380278/140b133ea52e55e63ea2bfae9630e14f22c80ac9/pgsql_schema_diff.py
@jmwenda
jmwenda / gist:1784834
Created February 10, 2012 00:39
api.py file
from django.contrib.auth.models import User
from django.shortcuts import render_to_response
from django.utils.encoding import force_unicode
from tastypie.resources import ModelResource,ALL
from tastypie import fields
from tastypie.serializers import Serializer
import pickle
#we deal with stuff related with content
from masomo.models import Content,Subject,Topic,Chapter,Page
#we now deal with stuff related with setup and devices
@jmwenda
jmwenda / gist:1784845
Created February 10, 2012 00:43
masomo models
#have to add subject here because of the import
class Subject(models.Model):
name = models.CharField("Subject", max_length=45)
description = models.TextField("Description", max_length=255)
def __unicode__(self):
return self.name
@models.permalink
def get_absolute_url(self):
return ('curricula',(),{})
@jmwenda
jmwenda / gist:1786953
Created February 10, 2012 05:33
file conent
<?xml version='1.0' encoding='utf-8'?>
<response><objects type="list"><object><description>theee</description><value>ewqqe</value><subject><name>Science</name><chapters type="list"><object><title>Weather and Solar System</title><topics type="list"><object><id>1</id><title>The Sky</title><pages type="list"><object><pagelabel>Page One</pagelabel><id>1</id><resource_uri>/api/masomo/page/1/</resource_uri></object></pages><resource_uri>/api/masomo/topic/1/</resource_uri></object></topics><resource_uri>/api/masomo/chapter/1/</resource_uri><description>wetho</description><id>1</id></object><object><title>Human Anatomy</title><topics type="list"/><resource_uri>/api/masomo/chapter/2/</resource_uri><description>humo</description><id>2</id></object></chapters><description>scio</description></subject></object></objects><meta type="hash"><next type="null"/><total_count type="integer">1</total_count><previous type="null"/><limit type="integer">20</limit><offset type="integer">0</offset></meta></response>