Skip to content

Instantly share code, notes, and snippets.

View WesleyDRobinson's full-sized avatar
🎚️

Wesley Robinson WesleyDRobinson

🎚️
View GitHub Profile
@WesleyDRobinson
WesleyDRobinson / analtyics-js-snippet.html
Created July 18, 2017 17:55
Segment's `analytics.js` snippet
<script type="text/javascript">
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="4.0.0";
analytics.load
@WesleyDRobinson
WesleyDRobinson / hubspot-mapper.js
Created June 26, 2017 22:07
hubspot serverside mapper
/**
* Module dependencies.
*/
var traverse = require('isodate-traverse')
var del = require('obj-case').del
var extend = require('extend')
var reject = require('reject')
var each = require('@ndhoule/each')
@WesleyDRobinson
WesleyDRobinson / set-sentAt.js
Last active June 13, 2017 22:28
funky timestamp behavior
// batch output in node
{
"batch": [
{
"userId": 1234,
"event": "strange Timestamp",
"properties": "[Object]",
"sentAt": "2001-06-01T07:00:00.000Z",
"timestamp": "2017-06-13T22:26:07.963Z",
"type": "track",
@WesleyDRobinson
WesleyDRobinson / context-user-traits.js
Created June 12, 2017 19:32
passing user traits in a track event context object
// protect 'user' methods from invoking before library is available: https://segment.com/docs/sources/website/analytics.js/#ready
analytics.ready(function () {
// retrieve user Traits: https://segment.com/docs/sources/website/analytics.js/#user-group-information
var userTraits = analytics.user().traits();
// invoke Track method: https://segment.com/docs/sources/website/analytics.js/#track
analytics.track('Event Triggered', {eventProp: 1}, {traits: userTraits})
})
@WesleyDRobinson
WesleyDRobinson / shameless.md
Created June 1, 2017 04:02
Mitch lays it out

hello newest graduated fullstack class!

here are some shameless plugs.

if you'd like to continue practicing REACTO type questions with the Fullstack alumni network, please join [Fullstack Alumni Slack channel] #reacto_all where you are paired with a new partner each week to practice these type of questions :thumbsup_all: it's a good opportunity to work on your technical interviewing skills and also to network within Fullstack

also here is a google doc i wrote up on what worked for me on my job search. the whole document is a bit long, but the summary of what to do for the technique is short (most of the doc is explaining the strategy). in general, what I found worked best for me was a “shotgun” approach, send out a lot of connections, send out a lot of messages, send out a lot of applications, and do it in as little time as possible, and then go from there. make up for the low hit rate you'll see just by doing big volume. some people prefer a more targeted approach but what I found is that when I moved

@WesleyDRobinson
WesleyDRobinson / snippet.html
Created May 9, 2017 00:05
segment snippet 4.0.0
<script type="text/javascript">
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="4.0.0";
analytics.load("Y
@WesleyDRobinson
WesleyDRobinson / README.md
Created August 1, 2016 19:00
Connect Kafka

connect-kafka

Connect Segment to Kafka in 5 minutes. Pipe Segment's data sources into your Kafka cluster.

Release: ALPHA

Features

connect-kafka is a simple server that you deploy in your infrastructure. It listens for Segment events and forwards them to the Kafka topic of your choice.

@WesleyDRobinson
WesleyDRobinson / Code.gs
Last active June 2, 2016 08:13
Synonyms Sidebar
/**
* Creates a menu entry in the Google Docs UI when the document is opened.
*
* @param {object} e The event parameter for a simple onOpen trigger. To
* determine which authorization mode (ScriptApp.AuthMode) the trigger is
* running in, inspect e.authMode.
*/
function onOpen(e) {
DocumentApp.getUi().createAddonMenu()
.addItem('Start', 'showSidebar')
@WesleyDRobinson
WesleyDRobinson / Shopify Checkout Script
Last active October 25, 2019 23:58
Please see comments for more up to date implementations!!
<script type="text/javascript">
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","group","track","ready","alias","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="3.0.1";
window.analytics.load("
// Event Payload
{
"event": "Slack Testing",
"userId": "loxley1160",
"properties": {
"name": "Robin Hood",
"email": "[email protected]",
"activities": {
"one": "stealing from the rich",
"two": "giving to the poor"