This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
var $body = $('body'); //Cache this for performance | |
var setBodyScale = function() { | |
var scaleSource = $body.width(), | |
scaleFactor = 0.9, | |
maxScale = 1000, | |
minScale = 30; | |
var fontSize = scaleSource * scaleFactor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
layout proc {|controller| controller.request.xhr? ? false : "application" } | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
cnet = ARGV[0] | |
raw = `curl -d "cnetid=#{cnet}&commit=Search" http://directory.uchicago.edu/` | |
doc = Nokogiri::HTML( raw ) | |
name = doc.xpath('//td[@headers="fullname"]').text | |
puts name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f = File.open("dist.all.last", 'r') | |
full = [] | |
h = {} | |
last = 0 | |
while( line = f.gets ) | |
data = [] | |
line.split(" ").each {|x| data << x} | |
full << data | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO html/jquery for getting all the points on the route | |
require 'yaml' | |
require 'json' | |
require 'open-uri' | |
require 'redis' | |
ROUTE = 1000299 | |
ERROR = 0.0001 #This is radial wiggle room for arriving buses, in lat/lng |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> | |
<style type="text/css"> | |
html { height: 100% } | |
body { height: 100%; margin: 0; padding: 0 } | |
#map_canvas { height: 100% } | |
</style> | |
<script type="text/javascript" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def scan_first(pattern) | |
a = self.scan(pattern) | |
a = a.first while a.is_a? Array unless a.empty? | |
return a | |
end | |
end | |
time_tokens = {} | |
given = ARGV[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+(NSMutableArray *) loadRemoteListings { | |
NSMutableArray *listings = [NSMutableArray arrayWithCapacity:20]; | |
NSURL *url = [[NSURL alloc] initWithString:@"http://localhost:3000"]; | |
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; | |
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"]; | |
NSURLResponse *response; | |
NSError *error; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+(NSMutableArray *) loadRemoteListings { | |
NSMutableArray *listings = [NSMutableArray arrayWithCapacity:20]; | |
NSURL *url = [[NSURL alloc] initWithString:@"http://localhost:3000"]; | |
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; | |
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"]; | |
NSURLResponse *response; | |
NSError *error; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// QUESTION: For some reason Devise only sees auth token when passed through url not as param | |
// WHY? this seems really insecure... | |
-(NSString *) concatURL { | |
NSString *base = @"http://localhost:3000"; | |
NSString *auth = [[NSUserDefaults standardUserDefaults] objectForKey:@"token"]; | |
return [NSString stringWithFormat:@"%@?auth_token=%@", base, auth]; | |
} | |
-(NSDictionary *) postListing { |
OlderNewer