Skip to content

Instantly share code, notes, and snippets.

View btaillon-coveo's full-sized avatar

Benjamin Taillon btaillon-coveo

  • Coveo
View GitHub Profile
@btaillon-coveo
btaillon-coveo / compare.mjs
Created September 29, 2023 17:57
compare nx runs
import { resolve, parse } from "node:path";
import { readFile, writeFile } from "node:fs/promises";
/**
* @typedef File
* @property {'file'} type
*/
/**
* @typedef Directory
@btaillon-coveo
btaillon-coveo / sequence-diagram.md
Last active October 11, 2023 19:54
SSR sequence diagram
---
config:
  theme: dark
  sequence:
    noteAlign: left
---
sequenceDiagram
  participant Headless as @coveo/headless
  participant SSR as Server-side
@btaillon-coveo
btaillon-coveo / CookieUtils.ts
Created March 27, 2023 14:36
CookieUtils.ts
// Code originally taken from : https://developers.livechatinc.com/blog/setting-cookies-to-subdomains-in-javascript/
export class Cookie {
private static prefix: string = "coveo_";
static set(name: string, value: string, expiration?: number) {
const host = this.getHostname();
if (host.split(".").length === 1) {
// no '.' in a domain - it's localhost or something similar
document.cookie = this.buildCookie(name, value, expiration);
} else {
/**
* @typedef Assets
* @property {string} [baseSrcPath]
* @property {string | string[]} globs
*/
/**
* @typedef Package
* @property {string} packageName
* @property {Assets | Assets[]} assets
@btaillon-coveo
btaillon-coveo / parsed_doc.json
Last active January 6, 2023 16:20
KIT-2174 parsed_doc diff
This file has been truncated, but you can view the full file.
[
{
"name": "search",
"controllers": [
{
"initializer": {
"kind": "function",
"name": "buildHistoryManager",
"params": [
{
@btaillon-coveo
btaillon-coveo / jsui-folding-like-headless.js
Last active November 18, 2022 19:45
JSUI folding like Headless
/**
* @typedef IQueryResult
* @property {IQueryResult[]} [childResults]
* @property {IQueryResult} [parentResult]
* @property {{ foldingcollection?: string, foldingparent?: string, foldingchild?: string, source: string }} raw
*/
/**
* @param {IQueryResult} parent
* @param {IQueryResult[]} results
@btaillon-coveo
btaillon-coveo / custom.html
Created July 21, 2022 21:10
Atomic custom result component with bindings
<!DOCTYPE html>
<html dir="ltr" lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=5.0" />
<title>Coveo Atomic: Custom component example</title>
<script type="module" src="/build/atomic.esm.js"></script>
<script nomodule src="/build/atomic.js"></script>
<link rel="stylesheet" href="/themes/coveo.css" />
@btaillon-coveo
btaillon-coveo / package-lock.json
Created June 9, 2022 18:13
lerna bootstrap package-lock.json
{
"name": "ui-kit",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "ui-kit",
"devDependencies": {
"@actions/core": "1.8.2",
"@actions/github": "4.0.0",
@btaillon-coveo
btaillon-coveo / decoder.html
Last active April 22, 2022 13:04
Chrome raw request payload decoder
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Recursive decoder</title>
<script>
/**
* @param {string} obj