Skip to content

Instantly share code, notes, and snippets.

View erikhazzard's full-sized avatar

Erik Hazzard erikhazzard

View GitHub Profile
#----------------------------------------
#Post
#----------------------------------------
class Post(models.Model):
#Slug is the 'short' version of the title, used in the URL and
# used as the primary key
slug = models.CharField(
primary_key=True,
max_length=255
)
var map = new OpenLayers.Map({
div: "map",
layers: [
new OpenLayers.Layer.Vector("GeoJSON", {
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "county_file.json",
format: new OpenLayers.Format.GeoJSON({})
})
})
var map = new OpenLayers.Map({
div: "map",
layers: [
new OpenLayers.Layer.Vector("GeoJSON", {
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "county_file.json",
format: new OpenLayers.Format.GeoJSON({})
})
})
gdal_translate -of PNG -a_srs EPSG:4326 -a_ullr -127.62 50.41 -66.42 21.61 original_image.png temp_output1.png
gdalwarp -t_srs '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs' temp_output1.png temp_output2.png
gdal_translate -of PNG -outsize 80% 80% temp_output2.png reprojected_image.png
@erikhazzard
erikhazzard / gist:1338153
Created November 3, 2011 22:46
KML extractAttributes style override
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="http://openlayers.org/dev/theme/default/style.css" type="text/css">
<link rel="stylesheet" href="http://openlayers.org/dev/examples/style.css" type="text/css">
<style>
polyline, polygon, circle{
(function() {
var codeeditor, dataeditor, init, svg_foot, svg_head, svgeditor, update;
svg_head = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\" \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n<svg version=\"1.0\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<g id=\"demoholder\">";
svg_foot = "</g>\n</svg>";
svgeditor = ace.edit("js_div0");
dataeditor = ace.edit("js_div1");
//Draw lines for each attribute, starting from origin
for(datum in RADAR._data.children){
if(RADAR._data.children.hasOwnProperty(datum)){
//Store x,y so we don't have to recalculate everytime
x = (Math.cos(index*2*Math.PI/6) * radius) + center[0]
y = (Math.sin(index*2*Math.PI/6) * radius) + center[1]
cur_value = RADAR._data.children[datum].value;
//DO STUFF
@erikhazzard
erikhazzard / gist:1607920
Created January 13, 2012 18:28
here's some regex
a = '<span>Abelmoschus esculentus</span><a href="#" class="search-choice-close" rel="1"></a>';
b = a.replace(/<[\/]?span>/g,'');
final_string = b.replace(/<a.*$/g,'');
@erikhazzard
erikhazzard / .vimrc
Created February 2, 2012 18:35
My vimrc
"-------------------------------------------
set nocompatible
syntax on
"Mouse
set mouse=a
set selectmode=mouse
set et
set sw=4
@erikhazzard
erikhazzard / ir_black.vim
Created February 2, 2012 19:03
ir_black theme
" ********************************************************************************
" Standard colors used in all ir_black themes:
" Note, x:x:x are RGB values
"
" normal: #f6f3e8
"
" string: #A8FF60 168:255:96
" string inner (punc, code, etc): #00A0A0 0:160:160
" number: #
" ********************************************************************************