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 / atomic-result-quickview.tsx
Created August 12, 2021 20:17
atomic-result-quickview
import {Component, State, h, Element, Prop} from '@stencil/core';
import {
Result,
buildQuickview,
QuickviewState,
Quickview,
} from '@coveo/headless';
import {ResultContext} from '../../result-template-components/result-template-decorators';
import {
Bindings,
@btaillon-coveo
btaillon-coveo / get-result-source.user.js
Last active March 10, 2022 15:47
Tempermonkey Script - Get result source
// ==UserScript==
// @name Get result source
// @description gets the source of a result.
// @namespace https://github.com/btaillon
// @updateURL https://gist.githubusercontent.com/btaillon/af627d1206dd5c687825f9a9b3cc04a5/raw/get-result-source.user.js
// @downloadURL https://gist.githubusercontent.com/btaillon/af627d1206dd5c687825f9a9b3cc04a5/raw/get-result-source.user.js
// @supportURL https://gist.githubusercontent.com/btaillon/af627d1206dd5c687825f9a9b3cc04a5
// @version 0.2
// @author btaillon
// @match *://*/*
@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
@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 / 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 / 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 / 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": [
{
/**
* @typedef Assets
* @property {string} [baseSrcPath]
* @property {string | string[]} globs
*/
/**
* @typedef Package
* @property {string} packageName
* @property {Assets | Assets[]} assets
@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 {