Skip to content

Instantly share code, notes, and snippets.

sudo apt-get install postgis postgresql-9.3-postgis-2.1
sudo -iu postgres createuser proj123 -S -D -R
sudo -iu postgres createdb proj123 -O proj123
sudo -iu postgres psql -c \"alter user proj123 with password 'proj123';\"
sudo -iu postgres psql proj123 -c \"CREATE EXTENSION postgis;\
sudo -iu postgres psql proj123 -c \"CREATE EXTENSION postgis_topology;\""
@nonZero
nonZero / cool.html
Created November 11, 2015 09:22
display points as leaflet markers
{% load staticfiles %}
<!doctype html>
<style>
#map {
height: 500px;
}
</style>
cool!
LEAFLET_CONFIG = {
'SPATIAL_EXTENT': (30, 29, 36, 33.5),
# 'DEFAULT_CENTER': MAP_CENTER,
'DEFAULT_ZOOM': 8,
'TILES': [
('OVI Satellite',
'http://maptile.maps.svc.ovi.com/maptiler/maptile/newest/satellite.day/{z}/{x}/{y}/256/png8',
'OVI maps'),
@nonZero
nonZero / calculator.py
Created November 18, 2015 10:15
tryneo
def calc(s):
return 4
@nonZero
nonZero / fetch.js
Created November 18, 2015 15:22
simple ajax
"use strict";
$(function () {
$.get("/the/url/of/the/maps/", function (maps) {
$.each(function (i, map) {
console.log(map);
})
});
<table id="mytable" border="1">
<tr>
<td>1</td>
<td>1</td>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<div id="add">Add!!</div>
<ul id="foo">
<li>0</li>
<li>0</li>
<li>0</li>
<li>0</li>
<li>0</li>
<li>0</li>
<li>0</li>
@nonZero
nonZero / add_to_settings.py
Created November 25, 2015 15:42
Enable GeoDjango on windows
import os
# ......
if os.name == 'nt':
OSGEO4W = r"C:\OSGeo4W"
os.environ['OSGEO4W_ROOT'] = OSGEO4W
os.environ['GDAL_DATA'] = OSGEO4W + r"\share\gdal"
os.environ['PROJ_LIB'] = OSGEO4W + r"\share\proj"
os.environ['PATH'] = OSGEO4W + r"\bin;" + os.environ['PATH']
@nonZero
nonZero / rates.js
Created December 2, 2015 14:19
simple ajax demo
$(function () {
"use strict";
$("#update-btn").click(function () {
var el = $(this);
if (el.attr("disabled")) {
return;
}
var url = el.data("url");
el.attr('disabled', "true");
@nonZero
nonZero / base.html
Created December 2, 2015 14:21
simple ajax examples
{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Ex Man!!!!!</title>