Skip to content

Instantly share code, notes, and snippets.

View PerStirpes's full-sized avatar
🥳
Party popper with a party hat

Matt Carl PerStirpes

🥳
Party popper with a party hat
View GitHub Profile
@PerStirpes
PerStirpes / animation.css
Created July 28, 2019 19:57
nudge cta -arrow and underline animations
.cta:hover .cta-arrow {
transform: translateX(3px);
}
.underline {
padding:9px 0 6px;
display:inline-block;
position:relative
}
@PerStirpes
PerStirpes / list_filtering_script.js
Created July 23, 2019 17:33
Filters viable emails from a bounced list
const fastcsv = require("fast-csv");
const { createWriteStream } = require("fs");
const unmailables = require("./unmailable");
const unsubscribers = require("./nps_unsub");
const Q2_List = require("./2019_Q2");
const ws = createWriteStream("out.csv");
const { random } = Math;
let mailable = [];
keyCode = Object.freeze({
'TAB': 9,
'RETURN': 13,
'ESC': 27,
'SPACE': 32,
'PAGEUP': 33,
'PAGEDOWN': 34,
'END': 35,
'HOME': 36,
'LEFT': 37,
@PerStirpes
PerStirpes / usePortal.js
Created June 30, 2019 03:02
Portal hook
import { useRef, useEffect, useState } from 'react'
import { findDOMNode, createPortal } from 'react-dom'
export default function usePortal({
closeOnOutsideClick = true,
closeOnEsc = true,
renderBelowClickedElement, // appear directly under the clicked element/node in the DOM
bindTo, // attach the portal to this node in the DOM
isOpen: defaultIsOpen = false
@PerStirpes
PerStirpes / audit_script.py
Last active August 11, 2020 00:48
Get Audit Log Feed
from future import print_function
import time
import launchdarkly_api
import csv
import datetime
Configure API key authorization: Token
configuration = launchdarkly_api.Configuration()
configuration.api_key['Authorization'] = 'api'
var request = require('request-promise');
var ldEnv = 'dev';
var ldProjKey = 'default';
var featureFlag = 'armada-ui';
var ldApiKey = process.env.LD_API_KEY;
// it is assumed this ldProjKey/featureFlag/ldEnv combo has at least 2 rules available
if(!ldApiKey){
@PerStirpes
PerStirpes / virtualize_traffic.py
Created March 7, 2019 23:09
autodesks script
""" A routine which simulates traffic in an A/B experiment. The binary flag being used has been configured
to rollout at 10% True 90% False. Below in the code, a loop is entered to simulate 1,000 unique users.
The True variant will hit the goal 80% of the time. The False variant will hit the goal 30% of the time.
So in LD, we should see the following insight numbers for the flag:
Flag Evaluations:
True: 100 (10% of 1,000)
False: 900 (90% of 1,000)
Conversions:
True: 80/100 (80% goal hit)
False: 270/900 (30% goal hit)
@PerStirpes
PerStirpes / export_audit_logs.py
Created March 5, 2019 08:33
Export LaunchDarkly audit logs to CSV
#!/usr/bin/env python3
"""
Requirements:
pip install requests python-dateutil
"""
import dateutil.parser as dp
import csv
import sys
from optparse import OptionParser
@PerStirpes
PerStirpes / VPN.sh
Last active January 10, 2020 06:36
setup script
# !/bin/sh
ecco_the_dolphin=(
"$(tput setaf 5)Installing Homebrew...$(tput sgr 0)"
"$(tput setaf 2)Please enter the password 🔑 you use to login to your computer$(tput sgr 0)"
)
for ecco_the_dolphin in "${ecco_the_dolphin[@]}"; do
echo "$ecco_the_dolphin"
done
@PerStirpes
PerStirpes / Docker shell commands.sh
Created January 26, 2018 00:51 — forked from bahmutov/Docker shell commands.sh
A personal cheat sheet for running local Node project in a Docker container
# See list of docker virtual machines on the local box
$ docker-machine ls
NAME ACTIVE URL STATE URL SWARM DOCKER ERRORS
default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1
# Note the host URL 192.168.99.100 - it will be used later!
# Build an image from current folder under given image name
$ docker build -t gleb/demo-app .