Skip to content

Instantly share code, notes, and snippets.

View netconstructor's full-sized avatar
💭
pushing pixels

Christian Hochfilzer netconstructor

💭
pushing pixels
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<title>CartoDB Sketch View</title>
<script type="text/javascript" src="../js/core.js"></script>
<script type="text/javascript" src="../js/settings.js"></script>
<script type="text/javascript" src="../js/mercator.js"></script>
<script type="text/javascript" src="../js/geometry.js"></script>
<script type="text/javascript" src="../js/model.js"></script>
@netconstructor
netconstructor / gist:2566441
Created May 1, 2012 08:45 — forked from andrewxhill/gist:1452995
Clustering stylings for CartoDB
#points_na{
marker-fill:#FF6600;
marker-opacity:0;
marker-width:35;
marker-line-color:white;
marker-line-width:3;
marker-line-opacity:0;
marker-placement:point;
marker-type:ellipse;
marker-allow-overlap:true;
@netconstructor
netconstructor / twitter_cdb
Created May 1, 2012 08:48 — forked from saleiva/twitter_cdb
Twitter Streaming API and CartoDB
var twitter = require('ntwitter');
var http = require('http');
var cartodb_username = '' // your CartoDB username
, cartodb_password = '' // your CartoDB password
, cartodb_consumer_key = '' // Your CartoDB API Key ('YOUR KEY')
, cartodb_consumer_secret = '' // Your CartoDB API Secret ('YOUR SECRET')
, cartodb_private_query = '' // An SQL query to run eg. 'SELECT cartodb_id FROM cables LIMIT 20'
, cartodb_request_url = 'https://' + cartodb_username + '.cartodb.com/oauth/request_token'
, cartodb_access_url = 'https://' + cartodb_username + '.cartodb.com/oauth/access_token'
@netconstructor
netconstructor / cartodb.js
Created May 1, 2012 08:48 — forked from javisantana/cartodb.js
simple cartodb nodejs client
// OAuth supports 3 legged and 2 legged (aka XAuth) authentication.
// This app demonstrates how to use 2 legged authentication with CartoDB
var sys = require('sys')
, querystring = require('querystring')
, OAuth = require('oauth').OAuth
, EventEmitter = require('events').EventEmitter;
function CartoDBClient(user, password, consumer_key, consumer_secret) {
@netconstructor
netconstructor / bounding circle on cartodb
Created May 1, 2012 08:49 — forked from andrewxhill/bounding circle on cartodb
Creates a bounding circle from the_geom_webmercator on cartodb
WITH inp as ( SELECT ST_Centroid(ST_Collect(ST_envelope(the_geom_webmercator))) as centroid,
ST_ConvexHull(ST_Collect(ST_Envelope(the_geom_webmercator))) as hull
FROM table_name GROUP BY some_column)
SELECT ST_Buffer(centroid,
ST_Length( ST_LongestLine(centroid, hull))) as the_geom_webmercator
FROM inp;
@netconstructor
netconstructor / postgis.rb
Created May 1, 2012 08:50 — forked from tokumine/postgis.rb
PostGIS 2.0 SVN Homebrew formula
# PostGIS 2.0SVN Homebrew Formula
#
# To use, place this file in /usr/local/Library/Formula/, then:
#
# > brew install gdal --HEAD --with-postgres
# > brew install postgis --HEAD --with-raster
#
# If you want the original formula back just go to /usr/local and do:
#
# > git checkout Library/Formula/postgis.rb
@netconstructor
netconstructor / install_postgis_osx.sh
Created May 1, 2012 08:51 — forked from oliverbarnes/install_postgis_osx.sh
Installing PostGIS 1.5.3 (old formula) for Postgres 9.1.3 (Mac)
#If you don't have Postgres installed yet:
# https://github.com/tsaleh/tammer-saleh/blob/master/views/posts/installing-postgresql-for-rails-3-1-on-lion.html.textil
#1. Install postgis 1.5.3. Latest is 2.0.0, so using url old formula on github
brew install https://raw.github.com/mxcl/homebrew/8a04a43763906e6a9bef68881acf997f3a6f6687/Library/Formula/postgis.rb
#2. Create a template to be used on creating GIS-enabled databases
createdb template_postgis
#3. Import Postgis Data
@netconstructor
netconstructor / json_to_postgre.php
Created May 1, 2012 08:53 — forked from mexitek/json_to_postgre.php
Script to automate an import process from .json file to postgre DB.
<?php
# Configure
$DB_USER = 'admin';
$DB_PASS = 'qwerty';
$DB_HOST = 'localhost';
$DB_NAME = 'postgis-2-0';
// Param 3 when ran in shell will override this value
$DB_TABLE = 'public.florida_establishments_garman';
// Param 2 when ran in shell will override this value
$CATEGORY = 'misc';
/*
* Portions of this code and logic copied from OpenLayers and
* redistributed under the original Clear BSD license terms:
*
* http://trac.osgeo.org/openlayers/browser/license.txt
*
* Copyright 2005-2010 OpenLayers Contributors, released under
* the Clear BSD license. See authors.txt for a list of contributors.
* All rights reserved.
*
@netconstructor
netconstructor / gist:2566553
Created May 1, 2012 08:57
Leaflet Stroke
<html>
<script src='./leaflet/leaflet.js'></script>
<link rel="stylesheet" href="./leaflet/leaflet.css" />
<body>
<div id='map' style="width: 600px; height: 400px"></div>
</body>
<script>
// Set up the map.
var map = new L.Map('map');
var tileUrl = 'http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg';