Skip to content

Instantly share code, notes, and snippets.

@c7x43t
c7x43t / flexsearch.fuzzy.js
Created October 29, 2024 16:13
Flexsearch fuzzy search
// Initialize a FlexSearch Document index with typo-tolerance and partial matching for products
const flexIndex = new FlexSearch.Document({
preset: 'match',
charset: "latin:advanced",
tokenize: "full",
resolution: 20,
document: {
id: "id",
index: [
{
@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@lovasoa
lovasoa / README.md
Last active January 21, 2021 19:56
Compute the intersection of large arrays in javascript

WARNING : This code now lives in its own github repository: lovasoa/fast_array_intersect. It is also published on npm: fast_array_intersect

Array intersect

Fastest function to intersect a large number of big arrays in javascript, without dependencies

  • The compressed version is only 345 caracters long.
  • Faster than common libraries, even a large number of arrays, or on very big arrays. (See benchmarks)
@eligrey
eligrey / html-domparser.js
Last active March 9, 2025 03:34
DOMParser HTML extension - Now a polyfill since HTML parsing was added to the DOMParser specification
/*
* DOMParser HTML extension
* 2019-11-13
*
* By Eli Grey, http://eligrey.com
* Public domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
/*! @source https://gist.github.com/1129031 */