Skip to content

Instantly share code, notes, and snippets.

@markng
markng / gist:1101904
Created July 23, 2011 21:28
Interactive translation tool.
#!/usr/bin/env python
import sys, tty, termios
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
try:
filename = sys.argv[1]
f = open(filename, 'r')
text = f.read()
@robflaherty
robflaherty / csv-to-json.php
Created September 1, 2011 02:26
Convert CSV to JSON
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed
@chrislkeller
chrislkeller / README.md
Last active September 28, 2015 10:18
Quick map creating a mouseover-like event on a google map using a Fusion Tables layer...

Demo: fusion-tables-pseudo-mouseover

This repo's location has changed.

@csessig86
csessig86 / GOP Caucus Results
Created January 6, 2012 20:55
Map of GOP caucus/primary dates and results
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Lee Enterprises - GOP Caucus/Primary Results</title>
<style>
body { height: 650px; width:610px;
font-family: Arial, sans-serif; }
@brianboyer
brianboyer / gist:1696819
Created January 29, 2012 02:21
Lion dev environment notes
@jkeefe
jkeefe / datacall.js
Created January 30, 2012 02:56
John's Iowa Data Call Code
var overview;
var overview_query_url = "https://www.google.com/fusiontables/api/query?sql=SELECT+PNCommunityType%2C+SUM('NumVoters')%2C+SUM('NumBallotBoxes')%2C+SUM('NumCountedBallotBoxes')%2C+SUM('VoteCount-Paul')%2C+SUM('VoteCount-Bachmann')%2C+SUM('VoteCount-Johnson')%2C+SUM('VoteCount-Gingrich')%2C+SUM('VoteCount-Santorum')%2C+SUM('VoteCount-Huntsman')%2C+SUM('VoteCount-Other')%2C+SUM('VoteCount-Roemer')%2C+SUM('VoteCount-Romney')%2C+SUM('VoteCount-Perry')%2C+SUM('VoteCount-Cain')+FROM+2486515&jsonCallback=?";
function refreshData() {
// Hit the Google Fusion Table
$.getJSON(overview_query_url, function(data) {
overview = data;
@chrislkeller
chrislkeller / README.md
Last active September 30, 2015 03:08
This has been updated here to reflect the coming changes to the Fusion Tables API.

SpreadSheet to Fusion Tables

This has been updated here to reflect the coming changes to the Fusion Tables API.

@chrislkeller
chrislkeller / Learning-python-django.md
Last active September 30, 2015 07:07
In my quest to learn how to use python within the django framework, the most difficult thing was the development environment, and getting to the point where I could play. Here are some steps that I took to get to that point.

In my quest to learn how to use python within the django framework, the most difficult thing was the development environment, and getting to the point where I could play learn, practice and experiment. Here are some steps that I took to get to that point.

I’ll add to this as I can, but mostly I’m using it as a handy resource that I can access while continuing to learn.

SETUP DJANGO PROJECT IN MY MAC OS DEV ENV

Cribbed from my notes and this blog post.

@zhm
zhm / gist:2005158
Last active February 28, 2022 17:11
Building GDAL 1.9 with ESRI FileGDB support on OS X Lion

Building GDAL 1.9.x with ESRI FileGDB support on OS X Lion

  • Download the SDK from ESRI's website http://resources.arcgis.com/content/geodatabases/10.0/file-gdb-api
  • Extract the SDK, and put the contents of the directory in a known location, I used ~/local/filegdb. Here's an example path to one of the files: ~/local/filegdb/lib/libFileGDBAPI.dylib
  • I use ~/local/filegdb so it can stay isolated in it's own place. You can put it anywhere, but the next few steps might be different.
  • Go into the directory containing the FileGDB SDK, e.g. ~/local/filegdb
  • ESRI built these dylib's using @rpath's, so to avoid needing to mess with DYLD_LIBRARY_PATH, I updated the @rpath's using install_name_tool. There might be a more elegant way to handle this. If so, comments are welcome!
  • Here are the commands I used to patch the dylibs, this is not required if you want to use DYLD_LIBRARY_PATH yourself:
@pgaertig
pgaertig / transpose_table.js
Created April 13, 2012 13:48
Transpose HTML table using jQuery
$(function() {
var t = $('#thetable tbody').eq(0);
var r = t.find('tr');
var cols= r.length;
var rows= r.eq(0).find('td').length;
var cell, next, tem, i = 0;
var tb= $('<tbody></tbody>');
while(i<rows){
cell= 0;