Skip to content

Instantly share code, notes, and snippets.

Avatar

Stuart Lynn stuartlynn

  • Two Sigma
  • Brooklyn
View GitHub Profile
@stuartlynn
stuartlynn / gist:5355651
Created Apr 10, 2013
Proxy touch events
View gist:5355651
function touchHandler(event)
+ {
+ var touches = event.changedTouches,
+ first = touches[0],
+ type = "";
+ switch (event.type)
+ {
+ case "touchstart":
+ type = "mousedown";
+ break;
@stuartlynn
stuartlynn / dabblet.css
Created Oct 2, 2013
The first commented line is your dabblet’s title
View dabblet.css
/**
* 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 Oct 2, 2013
The first commented line is your dabblet’s title
View dabblet.css
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: red;
min-height: 100%;
@stuartlynn
stuartlynn / dabblet.css
Created Oct 2, 2013
The first commented line is your dabblet’s title
View dabblet.css
/**
* 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 Dec 3, 2013
Small Sinatra script for geocoding ips
View gist:7778144
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
Language stats for project
View gist:51890ceeadda90102b5e
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
Planet hunters language stats
View gist:d32e62cc4256c8526945
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
View gist:91668bf98c46c51aeb6c
import kplr
import json
import csv
import code
import numpy as np
import sys
from itertools import izip
View gist:650d44ec7b1deb3904e3
require 'pg'
require 'rmagick'
require 'pry'
require 'json'
require 'date'
client = PG.connect(dbname: "world")
no_rows = 20#40
no_colls = 20#40
View gist:675cf0dc10e085bff177
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']