Skip to content

Instantly share code, notes, and snippets.

View ajturner's full-sized avatar
🗺️
Considering WhereCamps

Andrew Turner ajturner

🗺️
Considering WhereCamps
View GitHub Profile
@ajturner
ajturner / setTimeFilter.js
Created May 19, 2011 13:21
Example of GeoIQ setTimeFilter
// From May 5th 2010 to May 12 2010
mymap.setTimeFilter({begin:"2010-05-05T00:00:00Z", end: "2010-05-12T00:00:00Z"});
// From now until 1 week in the Future
mymap.setTimeFilter({begin:"now", period: "604800000"});
@ajturner
ajturner / styled_infowindows.html
Created June 8, 2011 13:37
Styled InfoWindows in GeoIQ
<script src="http://geocommons.com/javascripts/f1.api.js" type="text/javascript"></script>
<style type="text/css" media="screen">
#embed_map {width: 100%; height: 400px;}
</style>
<div id="embed_map"></div>
<div id="results"></div>
<script type="text/javascript" charset="utf-8">
var mymap = new F1.Maker.Map({
map_id: 48852,
@ajturner
ajturner / show_controls.html
Created June 8, 2011 14:11
Show Controls in GeoIQ
<script src="http://geocommons.com/javascripts/f1.api.js" type="text/javascript"></script>
<style type="text/css" media="screen">
#embed_map {width: 100%; height: 400px;}
</style>
<div id="embed_map"></div>
<ul>
<li>Zoom: <a href="#" onclick="mymap.showControl('Zoom',true);">show</a> | <a href="#" onclick="mymap.showControl('Zoom',false);">hide</a></li>
<li>Layers: <a href="#" onclick="mymap.showControl('Layers',true);">show</a> | <a href="#" onclick="mymap.showControl('Layers',false);">hide</a></li>
<li>Legend: <a href="#" onclick="mymap.showControl('Legend',true);">show</a> | <a href="#" onclick="mymap.showControl('Legend',false);">hide</a></li>
<script type="text/javascript" charset="utf-8">
@ajturner
ajturner / filter_map.json
Created June 10, 2011 13:05
Filter Map in GeoIQ
<script src="http://geocommons.com/javascripts/f1.api.js" type="text/javascript"></script>
<style type="text/css" media="screen">
#embed_map {width: 100%; height: 400px;}
</style>
<div id="embed_map"></div>
<h3>Filters</h3>
<ul>
<li><a href="#" onclick="filterCommunity('MONTGOMERY')">Montgomery</a></li>
<li><a href="#" onclick="filterCommunity('BOWNESS')">Bowness</a></li>
<li><a href="#" onclick="clearCommunity()">All Communities</a></li>
@ajturner
ajturner / hostip_geolocation.rb
Created November 22, 2011 00:54
Geolocate an IP Address with HostIP
#--
# Copyright (c) 2006 Andrew Turner <[email protected]>
#
# Based on Geocoder - Copyright (c) 2006 Paul Smith <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
@ajturner
ajturner / geoiq_layer.js
Created February 7, 2012 18:41
Adds a layer to a map and new features.
// Example of Adding a Structured layer to a map and then adding client side twitter messages
// This example includes categorical styling of sentiment. You can change the schema, the categories, etc.
var geoiq = new function() {
this.map = map;
this.twitter_layer = null;
this.createLayer = function () {
var self = this
var data = {};
@ajturner
ajturner / colors.html
Created March 21, 2012 18:22
Demonstration of changing DOM elements by manipulating CSS
<html>
<head>
<title>Change Color Modes</title>
<style type="text/css">
body {background-color: #444;}
a, a:visited {color: white;}
ul li { list-style-type: none; display: block; padding: 20px; border: 1px solid #bbb;}
.day { width: 50px; height: 50px; }
</style>
<script type="text/javascript">
@ajturner
ajturner / index.html
Last active December 12, 2015 00:48
Esri API example to draw arcs.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7,IE=9">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title></title>
<link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/css/esri.css">
<style>
html, body, #map {
@ajturner
ajturner / binary.rb
Created February 17, 2013 20:52 — forked from kyledrake/gist:4956808
Added Avro and total file output
require 'json'
require 'bson'
require 'msgpack'
require 'benchmark'
require 'avro'
#require 'ruby_protobuf'
test_hash = {'string' => 'test string', 'float' => 5}
file = File.open("test.json", 'wb')
@ajturner
ajturner / map.geojson
Created August 24, 2013 07:46
via:geojson.io
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.