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
const fs = require('fs'); | |
const path = require('path'); | |
// Usage: node main.js [optional har file path] [optional JSON dataLayer file path] | |
// Iterate over all files in $folderName, grouping them by name and then performing | |
// audit: hostname extaction, flagging dataLayer values observed in requests and exporting | |
// results as a csv file in the curent folder. | |
// REQUIREMENTS: | |
// * files should have the same name: fnac_home.json and fnac_home.har |
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
// flattenObject recursively takes an object with an arbitrary depth | |
// and return an object with all properties grouped at the root level. | |
// Useful to have reduce digitalData to the same level | |
// Exemple: | |
// const nestedObject = { a: { b: 1}, c: { d: { e: 3 }}}, f: [1,2,{ g: "lol"}]} | |
// flattenObject(nestedObject, null, {}) | |
// { b: 1, e: 3, f: [1,2], g: "lol"} | |
function flattenObject(object, key, output) { | |
// It's an object ? Recrusive call | |
if (typeof object == "object" && !(object instanceof Array)) { |
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
// Returns an array of launch element (rule, dataelements, ...) sorted | |
// by bytes length | |
function dataElementsWeights() { | |
// We use an object so that total is passed by reference (using an int would | |
// pass it by value, thus leading to a different value in each object instead | |
// of the total value) | |
var totalWeight = { | |
total: 0 | |
}; |
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
// config holds the required headers (authorization and content-type) to be passed to each request. | |
// To get a working token, just: | |
// 1- Go to oneTrust websites page and open your network | |
// 2- Click "Add Website" | |
// 3- Locate the request to the "token" endpoint in your network | |
// 4- In the Preview tab, locate the "access_token" property and copy/paste its value next to "Bearer" in the "authorization" | |
// header from the config object. Alternatively, if you have already instantiated an OTDomainAPI manager, use the method updateToken. | |
const config = { | |
headers: { | |
"accept": "application/json, text/plain, */*", |
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
// HOW TO: | |
// 1/ Update the STEPS_TO_CREATE array in the main function with the checkout steps names you want to create. Please list them in order. | |
// 2/ paste the script in the console from the ecommerce settings page. | |
main() | |
function main() { | |
// Indicate desired steps names, in order, that need to be created | |
var STEPS_TO_CREATE = ['shipping', 'payment']; |
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
/** UTILS **/ | |
async function after(delay, fn) { | |
return new Promise((resolve, reject) => { | |
let to = setTimeout(function () { | |
resolve(fn()); | |
clearTimeout(to); | |
}, delay) | |
}) | |
} |
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 exists = (collection, property) => collection[property] && collection[property].length > 0; | |
var debugMode = true | |
// rule Finder - Find the name of a _satellite direct call rules by script id | |
// TODO: | |
// - Refactor | |
// - Make it recursive | |
// USAGE: |
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
package main | |
import ( | |
"context" | |
"fmt" | |
"log" | |
"strings" | |
"github.com/chromedp/cdproto/network" | |
"github.com/chromedp/chromedp" |
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
/** | |
* Javasript adaptation of famous : https://lodev.org/cgtutor/raycasting.html | |
*/ | |
// TODO: find a way to remove the globals | |
const SCREEN_HEIGHT = 512 | |
const SCREEN_WIDTH = 384 | |
const MOVE_SPEED = (1 / 60) * 3 | |
const ROT_SPEED = (1 / 60) * 6 |
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
const fs = require('fs') | |
const path = require('path') | |
const DEV_MODE = true; | |
// utils | |
debug = (...messages) => DEV_MODE ? console.log(messages) : ""; | |
const parser = { | |
feed(filename, opts) { |
NewerOlder