Skip to content

Instantly share code, notes, and snippets.

@kressaty
kressaty / google_form_to_segment.js
Created June 30, 2021 22:17
Sends the submitted payload of a Google Form to Segment.
/**
Sends the submitted payload of a Google Form to Segment.
Steps to install:
1. modify the script below to include your base64 encoded write key (with a colon at the end!) per the Segment docs
2. set the event name you want
3. add as a script to your Google Form (More > Script Editor)
4. add "https://www.googleapis.com/auth/script.external_request" & "https://www.googleapis.com/auth/forms" to your oauthScopes key in appscript.json
5. set your script trigger to onFormSubmit
@benpickles
benpickles / action.js
Created March 18, 2016 16:19
Inject an Authorization header into a redux-api-middleware request with a Redux middleware.
import { CALL_API } from 'redux-api-middleware'
export function fetchLocations() {
return {
[CALL_API]: {
endpoint: 'http://api.somesite.com/api/locations',
method: 'GET',
// Don't have to manually add the Authorization header to every request.
headers: { 'Content-Type': 'application/json' },
types: ['REQUEST', 'SUCCESS', 'FAILURE']