Skip to content

Instantly share code, notes, and snippets.

View stuartlynn's full-sized avatar

Stuart Lynn stuartlynn

  • Two Sigma
  • Brooklyn
View GitHub Profile
@stuartlynn
stuartlynn / gist:5355651
Created April 10, 2013 15:30
Proxy touch events
function touchHandler(event)
+ {
+ var touches = event.changedTouches,
+ first = touches[0],
+ type = "";
+ switch (event.type)
+ {
+ case "touchstart":
+ type = "mousedown";
+ break;
@stuartlynn
stuartlynn / dabblet.css
Created October 2, 2013 16:27
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
div{
width: 200px
@stuartlynn
stuartlynn / dabblet.css
Created October 2, 2013 16:28
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: red;
min-height: 100%;
@stuartlynn
stuartlynn / dabblet.css
Created October 2, 2013 17:28
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
h1{
color: red;
@stuartlynn
stuartlynn / gist:7778144
Created December 3, 2013 21:55
Small Sinatra script for geocoding ips
require 'sinatra'
require 'pg'
require 'json'
require 'uri'
hash = URI.parse(ENV['HEROKU_POSTGRESQL_WHITE_URL'] || "http://localhost:5432/geo")
Client = PG.connect(hash.host, hash.port, nil , nil , hash.path.gsub("/",""), hash.user, hash.password)
# Client = Mysql2::Client.new(:host => "localhost", :username => "root")
@stuartlynn
stuartlynn / gist:51890ceeadda90102b5e
Created May 27, 2014 16:39
Language stats for project
require 'mongo'
client = Mongo::MongoClient.new
db = client["ouroboros"]
stats = {}
total = db["galaxy_zoo_classifications"].count
done = 0
db["galaxy_zoo_classifications"].find.each do |classification|
@stuartlynn
stuartlynn / gist:d32e62cc4256c8526945
Created May 27, 2014 16:49
Planet hunters language stats
select application_identifier, count(*), count(distinct zooniverse_user_id) from classifications where zooniverse_user_id is not null group by application_identifier
select application_identifier, count(*), count(distinct session_id) from classifications where zooniverse_user_id is null group by application_identifier
@stuartlynn
stuartlynn / gist:91668bf98c46c51aeb6c
Created July 17, 2014 15:50
Processing for PH2 site
import kplr
import json
import csv
import code
import numpy as np
import sys
from itertools import izip
@stuartlynn
stuartlynn / gist:650d44ec7b1deb3904e3
Last active August 29, 2015 14:04
Kelp processing
require 'pg'
require 'rmagick'
require 'pry'
require 'json'
require 'date'
client = PG.connect(dbname: "world")
no_rows = 20#40
no_colls = 20#40
require 'json'
require 'pry'
require 'aws-sdk'
require 'bson'
AWS.config access_key_id: ENV['S3_ACCESS_ID'], secret_access_key: ENV['S3_SECRET_KEY']
s3 = AWS::S3.new
bucket = s3.buckets['zooniverse-static']