This file contains hidden or 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
| # 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 |
This file contains hidden or 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
| 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: |
This file contains hidden or 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
| 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: |
This file contains hidden or 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
| 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" |
This file contains hidden or 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
| # 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 |
This file contains hidden or 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
| @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) | |
This file contains hidden or 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
| import urllib2 | |
| from BeautifulSoup import BeautifulSoup | |
| class Terminals(): | |
| def __init__(self): | |
| self.terminals = {} | |
| self.airports = ["jfk", "ewr", "lga"] | |
| self.getAllTerminals() | |
| def getAllTerminals(self): |
NewerOlder