Skip to content

Instantly share code, notes, and snippets.

@gbts
gbts / abtesting-lambda-oreq.js
Last active December 19, 2019 13:14
Lambda@Edge source code for A/B testing
'use strict';
const aws = require('aws-sdk');
const COOKIE_KEY = 'ABTesting-SegmentID';
const s3 = new aws.S3({ region: 'eu-west-1' });
const s3Params = {
Bucket: 'abtesting-ttblog-map',
Key: 'map.json',
@gbts
gbts / replace.py
Created October 4, 2023 17:03
Quick and dirty script to replace existing TS imports with ESM syntax with mandatory file extensions
#!/usr/bin/env python3
import fileinput
import glob
import os
import re
import sys
pattern = re.compile(r'from [\'\"](\.(\.)?(\/)?.*)[\'\"];')
def regex_match_rewrite(match, file_path, debug=False):