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
| package util | |
| import ( | |
| "reflect" | |
| ) | |
| // Restorer holds a function that can be used | |
| // to restore some previous state. | |
| type Restorer func() |
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
| package main | |
| // Restorer holds a function that can be used | |
| // to restore some previous state. | |
| type Restorer func() | |
| // Restore restores some previous state. | |
| func (r Restorer) Restore() { | |
| r() | |
| } |
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
| #!/usr/bin/env node | |
| var attractionService = require("../dataservices/attractions-service.js"); | |
| var im = require('imagemagick'); | |
| var fs = require('fs'); | |
| function createDataDir(page_type) { | |
| dir = "data/" + page_type; | |
| mkdirp(dir); | |
| return dir; | |
| } |
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
| 10.47.25.209 - - [06/Mar/2013:00:39:07 +0000] "GET /v1/entity/?entity_key=3b0d9bbee9a84e8bb6fa8321303faadb_http%3A%2F%2Ffeeds.news.com.au%2Fmx%2Frss%2Fmx_news_sport_3218.xml&entity_key=f4513fe0e70c4e7da0e305574256d03f_http%3A%2F%2Ffeeds.news.com.au%2Fmx%2Frss%2Fmx_news_sport_3218.xml&entity_key=512a5f64a0e64f9dabc9ccadcf7f6045_http%3A%2F%2Ffeeds.news.com.au%2Fmx%2Frss%2Fmx_news_sport_3218.xml&entity_key=1f3bef7a433744f3ba96a7b50df7f58d_http%3A%2F%2Ffeeds.news.com.au%2Fmx%2Frss%2Fmx_news_sport_3218.xml&entity_key=76889f864d804978ba35d9396653aba1_http%3A%2F%2Ffeeds.news.com.au%2Fmx%2Frss%2Fmx_news_sport_3218.xml&entity_key=23210b608b14497dafc49f93f593f5f8_http%3A%2F%2Ffeeds.news.com.au%2Fmx%2Frss%2Fmx_news_sport_3218.xml&entity_key=004f0cc194d243ccb27e9a6ceef55af0_http%3A%2F%2Ffeeds.news.com.au%2Fmx%2Frss%2Fmx_news_sport_3218.xml&entity_key=93e4d30adfd349fe87ee08f601be7afa_http%3A%2F%2Ffeeds.news.com.au%2Fmx%2Frss%2Fmx_news_sport_3218.xml&entity_key=686fc1d0410a4eea8f6e88b1cc85d9fe_http%3A%2F%2Ffeeds.news.com.a |
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
| 10.47.25.209 - - [06/Mar/2013:00:39:07 +0000] "GET /v1/entity/?entity_key=3b0d9bbee9a84e8bb6fa8321303faadb_http%3A%2F%2Ffeeds.news.com.au%2Fmx%2Frss%2Fmx_news_sport_3218.xml&entity_key=f4513fe0e70c4e7da0e305574256d03f_http%3A%2F%2Ffeeds.news.com.au%2Fmx%2Frss%2Fmx_news_sport_3218.xml&entity_key=512a5f64a0e64f9dabc9ccadcf7f6045_http%3A%2F%2Ffeeds.news.com.au%2Fmx%2Frss%2Fmx_news_sport_3218.xml&entity_key=1f3bef7a433744f3ba96a7b50df7f58d_http%3A%2F%2Ffeeds.news.com.au%2Fmx%2Frss%2Fmx_news_sport_3218.xml&entity_key=76889f864d804978ba35d9396653aba1_http%3A%2F%2Ffeeds.news.com.au%2Fmx%2Frss%2Fmx_news_sport_3218.xml&entity_key=23210b608b14497dafc49f93f593f5f8_http%3A%2F%2Ffeeds.news.com.au%2Fmx%2Frss%2Fmx_news_sport_3218.xml&entity_key=004f0cc194d243ccb27e9a6ceef55af0_http%3A%2F%2Ffeeds.news.com.au%2Fmx%2Frss%2Fmx_news_sport_3218.xml&entity_key=93e4d30adfd349fe87ee08f601be7afa_http%3A%2F%2Ffeeds.news.com.au%2Fmx%2Frss%2Fmx_news_sport_3218.xml&entity_key=686fc1d0410a4eea8f6e88b1cc85d9fe_http%3A%2F%2Ffeeds.news.com.a |
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 tracker | |
| meta = { | |
| 'ad_id':1234, | |
| 'browser': 'Mozilla/5.0', | |
| 'cpm': 1.34 | |
| } | |
| tracker.track_event('ad-click', meta) |
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 to_flat_dict(json_obj, flat_keyname="", flat_dict = {}): | |
| #recursive function that turns the json dict into key/values pairs | |
| format = "%s.%s" | |
| if flat_keyname == "": format = "%s%s" | |
| if isinstance(json_obj,dict): | |
| for (k, json_obj) in json_obj.items(): | |
| new_flatname = format % (flat_keyname,k) | |
| flat_dict = to_flat_dict(json_obj,new_flatname, flat_dict) |
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
| // invoke the call | |
| [socialize authenticateWithApiKey:@"YourApiKey" apiSecret:@"YourApiSecret"]; | |
| #pragma mark SocializeServiceDelegate implementation | |
| // implement the delegate | |
| -(void)didAuthenticate{ | |
| NSLog(@"Authenticated"); | |
| } | |
| // if the authentication fails the following method is called |
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
| index="socialize_events" bucket=mobile_user app_id=2 | timechart span="1day" count by user_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
| self.tracker_client = EventTrackerClient(host=EventTrackerClient.HOST_PROD) | |
| one_month = timedelta(days=90) | |
| end_date = datetime.now() | |
| start_date = end_date - one_month |