Skip to content

Instantly share code, notes, and snippets.

@dwl285
dwl285 / events_cleaned.sqlx
Last active Mar 16, 2020
Sessionisation from Looker to Dataform
View events_cleaned.sqlx
config {
type: "view"
}
select distinct
timestamp,
user_id,
name as event_name,
is as event_id
from
@dwl285
dwl285 / main.py
Created Nov 1, 2019
Sending data from BigQuery to Intercom using Google Cloud Functions
View main.py
import requests
from google.cloud import bigquery
# Intercom API access header
headers = {
'Authorization': 'Bearer access-token',
'Accept': 'application/json',
'Content-Type': 'application/json',
}
View MainController.js
app.controller('MainController', ['$scope', 'places', function($scope, places) {
$scope.mapCenter = { lat: 40.741934, lng: -74.004897, zoom: 17 };
places.success(function(data) {
$scope.geodata = data;
});
$scope.mapMarkers = geodataToMarkers($scope.geodata);
}]);
View places.js
app.factory('places', ['$http', function($http) {
return $http.jsonp('https://en.wikipedia.org/w/api.php?action=query&list=geosearch&gsradius=5000&gscoord=40.741934%7C-74.004897&gslimit=30&format=json&callback=JSON_CALLBACK')
.success(function(data) {
return data;
})
.error(function(data) {
return data;
});
}]);