Skip to content

Instantly share code, notes, and snippets.

View WesleyDRobinson's full-sized avatar
🎚️

Wesley Robinson WesleyDRobinson

🎚️
View GitHub Profile
@WesleyDRobinson
WesleyDRobinson / audience_investigation.md
Last active January 16, 2020 18:31
Optmizely Audiences

In our "Engineering" project, "Non-partner traffic" audience is not behaving how I would expect.

Trying to use the following logic:

Visitor does not match the following conditions: pathname String contains substring /partner/

And using the "exampleFeature" feature, "ON" and enabled for 100%, I would expect true flags where attributes is null or {} like so:

flag = optimizelyClientInstance.isFeatureEnabled(
@WesleyDRobinson
WesleyDRobinson / CreateZendeskTicket.js
Created December 3, 2019 23:18
Twilio Studio Function
exports.handler = function(context, event, callback) {
  const url = require('url')
  const fetch = require('node-fetch')
  const { zendeskAccessToken, zendeskAccessEmail, zendeskUrl } = context // context injected by Twilio Function
// using Basic Auth
  const encodedToken = new Buffer(`${zendeskAccessEmail}/token:${zendeskAccessToken}`).toString('base64')
  const headers = {
    'Authorization': `Basic ${encodedToken}`,
    'Content-type': 'application/json',
@WesleyDRobinson
WesleyDRobinson / mixinAlt.js
Last active December 4, 2019 22:46
composing instances > mixed-in classes
// Base Class
class ComicBookCharacter {
constructor(first, last) {
this.firstName = first
this.lastName = last
}
realName() {
return this.firstName + ' ' + this.lastName
}
@WesleyDRobinson
WesleyDRobinson / speedy.sh
Created September 11, 2019 17:37
Decrease time to start repeating; increase repeat rate
# set your keyboard repeat rate
defaults write -g InitialKeyRepeat -int 10 # normal minimum is 15 (225 ms)
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms)
@WesleyDRobinson
WesleyDRobinson / lowercaseFirstLetter.js
Last active February 22, 2019 22:26
lowercase the first letter of every key
// params = (accumulator, entry, index, object), where entry = [key, value]
const entriesReducer = (acc, [key, value]) => {
const firstLetter = value.charAt(0).toLowerCase()
const rest = value.slice(1)
acc[key] = `${firstLetter}${rest}`
return acc
}
// accepts an object, returns an object
const lowerCaseAllValues = (obj) => {
@WesleyDRobinson
WesleyDRobinson / blog.md
Last active August 16, 2018 22:23
Make a new blog

yarn global add gatsby-cli

wait ~1 min

gatsby new gatsby-blog https://github.com/gatsbyjs/gatsby-starter-blog

wait ~2 min

cd gatsby-blog && gatsby develop

@WesleyDRobinson
WesleyDRobinson / git.md
Last active August 15, 2018 23:15
Navigating Git rebase with squash & fixup

It all started with a $ git init

Make a branch:

git checkout -b branch

Do stuff in multiple commits

Rebase before pushing to Github

for sanity, clarity, and posterity

/* Please write the following function:
is_valid_solution(string grid) => boolean
The input, grid, is a string representing a grid starting in the top­left corner and moving row­by­row down to the bottom­right.
For instance, the (valid) grid pictured above would be:
grid = "835416927296857431417293658569134782123678549748529163652781394981345276374962815"
### Keybase proof
I hereby claim:
* I am wesleydrobinson on github.
* I am wdr (https://keybase.io/wdr) on keybase.
* I have a public key ASDktCfHLamlstAlpLwqD5WbYZ1VWeVxPpG-sO6NqbyXjAo
To claim this, I am signing this object:
@WesleyDRobinson
WesleyDRobinson / index.js
Created August 8, 2017 23:47
mixpanel server side destination source code
'use strict'
/**
* Module dependencies.
*/
var integration = require('../../../createIntegration')
var parse = require('ua-parser-js')
var object = require('obj-case')
var time = require('unix-time')