Skip to content

Instantly share code, notes, and snippets.

View benjaminhoffman's full-sized avatar

Benjamin Hoffman benjaminhoffman

View GitHub Profile
@benjaminhoffman
benjaminhoffman / gtm_intercom_1_widget_styles_logic.html
Last active December 23, 2017 01:38
Intercom Chat widget HTML/CSS/JS for Google Tag Manager (GTM) (see comments below for install instructions)
<a class="intercom-launcher" href="{{intercom_chat_widget_id}}@incoming.intercom.io">
<div class="intercom-icon-close"></div>
<div class="intercom-icon-open"></div>
<span class="intercom-unread-count"></span>
</a>
<style>
.intercom-launcher {
backface-visibility: hidden;
background: {{color_black}};
@benjaminhoffman
benjaminhoffman / gtm_intercom_0_snippet.html
Last active July 3, 2018 08:23
Intercom Chat widget snippet for Google Tag Manager (GTM) (see comments below for install instructions)
<script>
window.intercomSettings = { app_id: {{intercom_chat_widget_id}} };
</script>
<script>
(function () { var w = window; var ic = w.Intercom; if (typeof ic === "function") { ic('reattach_activator'); ic('update', intercomSettings); } else { var d = document; var i = function () { i.c(arguments) }; i.q = []; i.c = function (args) { i.q.push(args) }; w.Intercom = i; function l() { var s = d.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = 'https://widget.intercom.io/widget/{{intercom_chat_widget_id}}'; var x = d.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x); } if (w.attachEvent) { w.attachEvent('onload', l); } else { w.addEventListener('load', l, false); } } })()
</script>
@benjaminhoffman
benjaminhoffman / gtm_intercom.json
Last active November 15, 2020 16:28
Google Tag Manager JSON Import for Intercom Chat Widget (see comments below for instructions)
{
"exportFormatVersion": 2,
"exportTime": "2017-12-23 01:07:53",
"containerVersion": {
"path": "accounts/1234567890/containers/8139018/versions/0",
"accountId": "1234567890",
"containerId": "12345678",
"containerVersionId": "0",
"container": {
"path": "accounts/1234567890/containers/8139018",
@benjaminhoffman
benjaminhoffman / sw.js
Created December 22, 2017 23:34
notes from service workers course on udacity (https://classroom.udacity.com/courses/ud899)
// from https://classroom.udacity.com/courses/ud899/lessons/6381510082/concepts/63774101620923
// registers a service worker; returns a promise
navigator.serviceWorker('sw.js')
.then(reg => {
// methods:
reg.unregister()
reg.update()
// properties: waiting, installing, active
import { createAction } from 'redux-actions'
import request from 'superagent'
import { enabledIntegration } from '../analytics/enable'
export const ENABLE_INTEGRATION_REQUESTING = 'ENABLE_INTEGRATION_REQUESTING'
export const ENABLE_INTEGRATION_ERROR = 'ENABLE_INTEGRATION_ERROR'
export const ENABLE_INTEGRATION_REQUESTED = 'ENABLE_INTEGRATION_REQUESTED'
export const enableIntegrationRequesting = createAction(ENABLE_INTEGRATION_REQUESTING)
export const enableIntegrationError = createAction(ENABLE_INTEGRATION_ERROR)
➜ app git:(canary) robo prod hello
hello :)
➜ app git:(canary) git pull origin canary
From ssh://github.com/segmentio/app
* branch canary -> FETCH_HEAD
Already up-to-date.
➜ app git:(canary) scripts/deploy.sh
The current version is: 3.138.0
Will deploy 3.139.0. Is this OK? (y/n) y
Deploying 3.139.0
➜ app git:(canary) robo prod hello
hello :)
➜ app git:(canary) git pull origin canary
From ssh://github.com/segmentio/app
* branch canary -> FETCH_HEAD
Already up-to-date.
➜ app git:(canary) scripts/deploy.sh
The current version is: 3.138.0
Will deploy 3.139.0. Is this OK? (y/n) y
Deploying 3.139.0
{ first_name: 'Fred',
last_name: 'Jones',
role: null,
title: 'General Manager',
seniority: null,
gender: null,
city: 'London',
country: 'United Kingdom',
twitter: null,
twitter_company: 'Uber',