Skip to content

Instantly share code, notes, and snippets.

View mikeyk's full-sized avatar

Mike Krieger mikeyk

  • San Francisco, CA
View GitHub Profile
- (NSString *)stringFromURL:(NSURL *)url
{
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url
cachePolicy:NSURLRequestReturnCacheDataElseLoad
timeoutInterval:30];
// Fetch the response
NSData *urlData;
NSURLResponse *response;
NSError *error;
NSMutableDictionary * hashedLocations = [NSMutableDictionary dictionaryWithCapacity:100];
NSArray * lastResultList = [dataSource locations];
for (InfoLocation * infoloc in lastResultList) {
InfoLocation * infoLocCopy = [[InfoLocation alloc] initWithInfoLocation:infoloc];
CLLocationCoordinate2D coord = [infoloc coordinate];
NSString * hash = [NSString stringWithFormat:@"%.5f-%.5f", coord.latitude, coord.longitude];
if (![hashedLocations objectForKey:hash]) {
[hashedLocations setValue:[[NSNumber alloc] initWithInt:1] forKey:hash];
} else {
// offset a bit so we don't have a bunch of clustered ones
//
// InfoLocation.h
// sfinfo
//
// Created by Mike Krieger on 8/30/09.
// Copyright 2009 Mike Krieger. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
function normalizeData(data){
for (entry in data) {
var deduplicatedEntries = {};
var originalData = data[entry]['data'];
for (var i = 0; i < originalData.length; i++) {
var keyindex = originalData[i][0];
var value = originalData[i][1];
deduplicatedEntries[keyindex] = (deduplicatedEntries[keyindex] || 0) + value;
}
var deduplicatedArray = [];
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<style type="text/css">
#simone {
background: black;
height: 10px;
width: 500px;
height: 5px;
// ==UserScript==
// @name RetweetHelper
// @namespace retweethelper
// @include http://twitter.com/home
// @exclude http://twitter.com/*/status/*
// ==/UserScript==
/*
by Mike Krieger (@mikeyk)
#!/usr/local/bin/python2.5
from BeautifulSoup import BeautifulSoup
import urllib
import cgitb
import cgi
cgitb.enable()
MAX_PAGES = 50
from BeautifulSoup import BeautifulSoup
def main():
friendsfl = open('friends.xml')
followersfl = open('followers.xml')
friendsoup = BeautifulSoup(friendsfl)
followsoup = BeautifulSoup(followersfl)
friend_list = set()
follow_list = set()