Skip to content

Instantly share code, notes, and snippets.

View anderser's full-sized avatar

Anders Eriksen anderser

View GitHub Profile
-- http://overpass-turbo.eu/
-- https://gist.github.com/atlefren/60234fb68d8299136c05
-- http://www.norkart.no/produkt/datavarehus/
-- toalett og kommunekart
SELECT
f.cartodb_id,
f.the_geom_webmercator,
f.the_geom,
@bsweger
bsweger / useful_pandas_snippets.md
Last active April 9, 2024 10:22
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@jvilledieu
jvilledieu / Offshore Leaks and Azerbaijan.adoc
Last active October 28, 2015 14:38
How to use Neo4j to analyse the Offshore Leaks : the case of Azerbaijan

How to use Neo4j to analyse the Offshore Leaks : the case of Azerbaijan

This interactive Neo4j graph tutorial shows how to use Neo4j to analyse the Offshore Leaks : the case of Azerbaijan.


@guilbep
guilbep / Gruntfile.js
Created December 13, 2013 15:54
best grunt file
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
copy: {
main: {
files: [{
expand: true,
cwd: './partials/',
@creg-ny-baa
creg-ny-baa / cartodb2qgis.py
Last active December 22, 2015 11:49
View CartoDB data (from a public table) in QGIS 1.8. Substitute your user name and SQL, and paste it in the python console.
# Run in QGIS python console for read-only view of CartoDB table
# Substitute your user name and query on first two lines
cartoName = "" # PUT YOUR USER NAME IN THE QUOTES
cartoQuery = "" # PUT YOUR QUERY IN THE QUOTES
import urllib
cartoUrl = 'http://{}.cartodb.com/api/v2/sql?format=GeoJSON&q={}'.format(cartoName, cartoQuery)
response = urllib.urlopen(cartoUrl)
content = response.read()
@iros
iros / storyboard.example.js
Created November 9, 2012 17:26
Miso Storyboard Example
var interactive = new Miso.Storyboard({
// our initial state will be loading
initial : 'loading',
scenes : {
loading: {
enter : function() {
// show that we are in a loading state
$('#loading').show();
@pwenzel
pwenzel / git-log-to-tsv.sh
Created June 6, 2012 20:53
Git Log to Tab-Delimited CSV File
# Local Dates:
git log --date=local --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.local.tsv.txt
# ISO Dates:
git log --date=iso --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.iso.tsv.txt
@palewire
palewire / LOCATING_THE_STORY.textile
Created January 30, 2012 23:59
Locating the story: The latest in mapping.

Locating the story: The latest in mapping

A collection of links for a NICAR 2012 presentation. It will suggest broad themes for the past year, and try to support them with examples from work in the field. This is a work in progress. Feel free to crap on it, or add your own ideas.

Escape from Google Maps

  • Google changed the rules of the game. There are now usage limits. Read about them here
  • TileMill, custom tiles, need examples
  • Links to ranty blog posts from Nestoria guy and others
  • One replacement is simple line maps drawn using HTML5 technologies like SVG, Canvas and VML. You saw this example a lot in election maps during the GOP primaries, like NYT, WaPo, HuffPo, LAT
#!/usr/bin/env python
import argparse
import datetime
import httplib2
import json
import sys
import urllib
BASE = "https://api.twitter.com/1/statuses/user_timeline.json?"
@n1k0
n1k0 / gist:1501173
Created December 20, 2011 10:44 — forked from fbuchinger/gist:1501115
PhantomJS: Capturing single dom elements as png files
var page = new WebPage(),
address, output, size;
//capture and captureSelector functions adapted from CasperJS - https://github.com/n1k0/casperjs
capture = function(targetFile, clipRect) {
var previousClipRect;
var clipRect = {top: 0, left:0, width: 40, height: 40};
if (clipRect) {
if (!isType(clipRect, "object")) {
throw new Error("clipRect must be an Object instance.");