Skip to content

Instantly share code, notes, and snippets.

@angelwong
angelwong / routes.yml
Last active February 26, 2020 20:53
routes.yaml
- title: Places API
to: /api/
items:
- title: Overview
to: /api/
- title: Getting Started
to: /api/getting-started/
- title: Versioning
to: /api/versioning/
- title: Authentication
@angelwong
angelwong / veolia.html
Created July 26, 2018 20:00
Veolia / Dexter bot embed
<style>
.DexterWidget--3Gs4e .WebWidget-toggle--3orU9 {
background-color: #2c2c2c !important;
}
.DexterWidget--3Gs4e {
font-family: 'TheSans-OT', arial, sans-serif !important;
}
.DexterWidget--3Gs4e .MessagePanel-header--3At-q {
background-color: #2c2c2c !important;
}
@angelwong
angelwong / veolia.html
Last active September 19, 2018 18:18
Veolia / Dexter embed (include in <head> tag)
<meta name="viewport" content="width=device-width,initial-scale=1">
<style>
.DexterWebWidget span, .DexterWebWidget input, .DexterWebWidget a {
font-family: 'TheSans-OT', arial, sans-serif !important;
-webkit-font-smoothing: auto !important;
letter-spacing: 0rem !important;
}
.WebWidget-open .DexterWebWidget .DexterWebWidget-toggle {
background-color: black !important;
}
@angelwong
angelwong / Code.gs
Created March 8, 2017 18:16
Include these methods in the "Code.gs" file of the "Script editor" of your Google Spreadsheet Bot
function getWeather(zip, additionalText) {
var response = UrlFetchApp.fetch("http://api.poncho.is/weather/forecast/"+zip)
, obj = JSON.parse(response.getContentText())
;
return [ [obj.data.body+additionalText, obj.data.media] ]
}
/*
* Retrieves the URL to the active spreadsheet
@angelwong
angelwong / httpMethods.gs
Created March 8, 2017 18:13
Include these methods in the "httpMethods.gs" file of the "Script editor" of your Google Spreadsheet Bot
/*
* Handle a GET request
*
* @param { Object } e - The request object https://developers.google.com/apps-script/guides/web#url_parameters
*/
function doGet(e) {
return ContentService.createTextOutput(
JSON.stringify(lookupAndCompute(null, e.parameter.text))
).setMimeType(ContentService.MimeType.JSON);
}
@angelwong
angelwong / httpMethods.gs
Created March 8, 2017 18:09
Include these methods in the "Script editor... of your Google Spreadsheet
/*
* Handle a GET request
*
* @param { Object } e - The request object https://developers.google.com/apps-script/guides/web#url_parameters
*/
function doGet(e) {
return ContentService.createTextOutput(
JSON.stringify(lookupAndCompute(null, e.parameter.text))
).setMimeType(ContentService.MimeType.JSON);
}
@angelwong
angelwong / location_json.py
Created December 17, 2014 02:52
Parsing JSON for each Latitude/Longitude
import pandas as pd
import os
import json
import glob
import string
# create data frame to capture top venues for each location
df_ = pd.DataFrame()
@angelwong
angelwong / location_api.py
Last active August 29, 2015 14:11
Pulling Foursquare API for top 80 Latitude/Longitudes in OpenNYC 311 data
import pandas as pd
from urllib2 import Request, urlopen, URLError
import json
import config
import os
# imports csv to dataframe
csv = pd.read_csv('noisy_top.csv')
#converts latitude/longitude into url for api endpoint
lat_long = [str(csv['Latitude'][i]) + "," + str(csv['Longitude'][i]) for i in range(csv['Latitude'].count())]