This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var waitUntil = function(callback) { | |
if (typeof callback === 'function') { | |
return new Promise(function(resolve, reject) { | |
var tick = setInterval(function() { | |
if (callback() === true) { | |
clearInterval(tick); | |
return resolve(); | |
} | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import os | |
import pyspark | |
from itertools import product | |
experiment_list = ['20389491581'] | |
output_dir = os.getcwd() + 'some path' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.getCookie = function(name) { | |
var match = document.cookie.match(name + '=([^;]*)'); | |
return match ? match[1] : undefined; | |
}; | |
window.setCookie = function(name, value, days, domain) { | |
var d = new Date(); | |
d.setTime(d.getTime() + 24 * 60 * 60 * 1000 * days); | |
document.cookie = name + "=" + value + ";domain=" + domain + ";path=/;expires=" + d.toGMTString(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Install required libraries: | |
- yargs (CLI) | |
- fast-csv (csv parser and writer) | |
- @optimizely/optimizely-sdk (optimizely SDK) | |
The following script takes in the following CLI arguments: | |
sdkKey (str): SDK Key of Optimizely datafile you wish to use | |
csv_file_path (str): The input CSV relative path with the following columns --> "User Identifier", "Bucketing ID", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { logger as logger$1 } from 'log'; | |
import { httpRequest } from 'http-request'; | |
import 'create-response'; | |
import { Cookies } from 'cookies'; | |
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | |
function unwrapExports (x) { | |
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "hello_world_test", | |
"author": "", | |
"license": "Apache-2.0", | |
"version": "2.0.0", | |
"description": "Example hello world test", | |
"main": "index.js", | |
"scripts": { | |
"build-webpack": "webpack && npm run build-zip", | |
"build-rollup": "rollup -c && tar -czvf ../ew.tgz -C dist bundle.json main.js", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import resolve from '@rollup/plugin-node-resolve'; | |
import commonjs from '@rollup/plugin-commonjs'; | |
import copy from 'rollup-plugin-copy-assets'; | |
import json from 'rollup-plugin-json'; | |
export default { | |
// Specify main file for EdgeWorker | |
input: 'index.js', | |
// Define external modules, which will be provided by the EdgeWorker platform | |
external: ['cookies', 'http-request', 'log', 'create-response'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"plugin_type": "widget", | |
"name": "Exit Modal", | |
"edit_page_url": "https://www.brother-usa.com/products/mfcj995dw", | |
"form_schema": [ | |
{ | |
"default_value": "Thanks for visiting Brother!", | |
"field_type": "text", | |
"name": "headline1", | |
"label": "Headline 1", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This tracks clicks to Iframes | |
window.inIframe = false; | |
| |
//Basically the next two event listeners turn this "inIframe" variable from false to true if they are within | |
//the bounds of the iframe by using mouseenter/mouseleave | |
document.querySelector('selector_here').addEventListener('mouseenter', function(){ | |
inIframe = !inIframe | |
}) | |
| |
document.querySelector('selector_here').addEventListener('mouseleave', function(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var templatePayload = { | |
"account_id": 'account123', | |
"visitors": [{ | |
"visitor_id": null, | |
"attributes": {}, | |
"snapshots": [{ | |
"decisions": [], | |
"events": [] | |
/* | |
https://developers.optimizely.com/x/events/api/index.html |