Skip to content

Instantly share code, notes, and snippets.

@ashaegupta
ashaegupta / terminals_webscraper.py
Created September 28, 2011 17:49
Scrapes web for airline arrival terminals
import urllib2
from BeautifulSoup import BeautifulSoup
class Terminals():
def __init__(self):
self.terminals = {}
self.airports = ["jfk", "ewr", "lga"]
self.getAllTerminals()
def getAllTerminals(self):
@ashaegupta
ashaegupta / get_matches_for_status_matched
Created October 19, 2011 02:08
Way to improve this
@classmethod
def get_matches_for_status_matched(klass, ride_doc):
ride=[]
# first ensure status is matched
if ride_doc.get(Ride.A_STATUS)==2:
# get the match ride and user info
match_ride_id = ride_doc.get(Ride.A_MATCH_ID)
@ashaegupta
ashaegupta / gist:1361433
Created November 13, 2011 01:19
Instadeshred
# instachallenge
# http://instagram-engineering.tumblr.com/post/12651721845/instagram-engineering-challenge-the-unshredder
from PIL import image
PIXEL_DIFF_CONSTANT = 2
IMAGE_HEIGHT = 369
IMAGE_WIDTH = 640
SHRED_WIDTH = 32
PIXEL_IN_COL_TO_SAMPLE= [2,29,40,210,123,122,111,123,190,304,504] # Automate
@ashaegupta
ashaegupta / gist:1363015
Created November 14, 2011 01:16
unshredded Revised
from PIL import Image
PIXEL_DIFF_CONSTANT = 2
IMAGE_HEIGHT = 359
IMAGE_WIDTH = 640
SHRED_WIDTH = 32
PIXEL_IN_COL_TO_SAMPLE = [2,29,40,210,123,122,111,123,190,304] # Automate
NUMBER_OF_COLUMNS = IMAGE_WIDTH/SHRED_WIDTH
FILE = "TokyoPanoramaShredded.png"
def fs_parse_response(response, yelp_results):
results = {}
results["body"] = []
results["has_ordered_results"] = True
try:
r = response["response"]
groups = r["groups"]
groups = groups[0]
items = groups["items"]
for item in items:
def fs_parse_response(response, yelp_results):
results = {}
results["body"] = []
results["has_ordered_results"] = True
try:
r = response["response"]
groups = r["groups"]
groups = groups[0]
items = groups["items"]
for item in items:
@ashaegupta
ashaegupta / process_reviews.py
Created April 3, 2012 00:16
process_reviews.py
# Top level attributes
PLACE_ID_A = 'place_id'
FS_ID_A = 'fs_id'
YELP_ID_A = 'yelp_id'
PHONE_A = 'phone'
NAME_A = 'name'
LOCATION_A = 'loc' # dict, see sub attributes below
REVIEW_A = 'review' # single incoming review; a dict, see sub attributes below
ALL_REVIEWS_A = 'all_reviews' # list of raw reviews
RECOS_A = 'recos' # dict of processed reviews
@ashaegupta
ashaegupta / gist:3906785
Created October 17, 2012 17:11
sidekiq failures
Failures:
1) Javascript tracker
When clients install javascript on their site, it should send us events
sends a page event for the current session
Failure/Error: wait_until { @session = mongo.sessions.find_one }
Capybara::TimeoutError:
timed out
# ./spec/acceptance/javascript_tracker_spec.rb:14:in `find_session'
# ./spec/acceptance/javascript_tracker_spec.rb:26:in `block (2 levels) in <top (required)>'
@ashaegupta
ashaegupta / gist:3906790
Created October 17, 2012 17:11
Master failures
Finished in 732.73 seconds
602 examples, 16 failures, 3 pending
Failed examples:
rspec ./spec/acceptance/email_layouts_spec.rb:12 # Email layouts
Allow users to manage and use their email layouts for their emails
Can create a new layout
rspec ./spec/acceptance/logs_spec.rb:20 # Logs
Clients should be able to see a stream of events they are tracking

Indentations

Agenda

Reminder the girls: Coding is about trial & error. Don't be afraid to mess up, because you can't. The more you experiment and mess up, the more you'll learn.

  • Review h1, h2, h3, img, a, br
  • Tag order matters
  • Parents & Children
  • Indentation