Skip to content

Instantly share code, notes, and snippets.

View Haroenv's full-sized avatar

Haroen Viaene Haroenv

View GitHub Profile
@Haroenv
Haroenv / input.scss
Created February 7, 2023 12:51
Generated by SassMeister.com.
@function foo($a, $b) {
@return $a + $b;
}
@function bar($start) {
$output: $start;
@for $i from 0 to 100 {
$output: $output + foo($i, 3)
}
@return $output
const path = require('path');
const webpack = require('webpack');
const isProd = process.env.NODE_ENV === 'production';
module.exports = [
{
name: 'plugin',
entry: {
// replace this with your source file
export { default as Hogan } from 'hogan.js';
export { default as instantsearch } from 'instantsearch.js';
export { default as algoliasearch } from 'algoliasearch/lite';
export {
default as autocomplete,
getAlgoliaResults,
getAlgoliaHits,
highlightAlgoliaHit,
} from 'autocomplete.js';
export { default as aa } from 'search-insights';
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><link rel="icon" href="/favicon.ico"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="manifest" href="/site.webmanifest"/><link href="https://fonts.googleapis.com/css2?family=Gochi+Hand&amp;family=Roboto&amp;display=swap" rel="stylesheet"/><meta name="viewport" content="width=device-width"/><meta charSet="utf-8"/><title>#coronamaison: Tous les dessins du hashtag #coronamaison</title><meta name="title" content="#coronamaison: Tous les dessins du hashtag #coronamaison"/><meta name="description" content="Ce site contient tous les dessins du hashtag #coronamaison publiés sur les réseaux sociaux. Ils sont organisés par date et popularité. Découvrez-les !"/><meta property="og:type" content="website"/><meta property="og:url" content="https://coronamaison.now.sh"/><meta pro
import algoliasearch from 'algoliasearch';
import { encode, addMethods } from '@algolia/client-common';
import { MethodEnum } from '@algolia/requester-common';
import {
createBrowsablePromise,
browseObjects,
BrowseResponse,
SearchResponse,
ObjectWithObjectID,
} from '@algolia/client-search';
@Haroenv
Haroenv / widgetTree.js
Last active December 16, 2019 10:31
InstantSearch widget tree
tree = indexWidget => indexWidget.getWidgets().map(widget => widget.$$type === 'ais.index' ? { ...widget, children: tree(widget) } : widget);
// usage:
tree(search.mainIndex)
@Haroenv
Haroenv / PlacesSearch.vue
Created November 27, 2019 10:01
A Vue + Places.js widget
<template>
<!-- container for places.js -->
<div>
<div id="algolia-places" />
</div>
</template>
<script>
import { createWidgetMixin } from 'vue-instantsearch';
import places from 'places.js';
@Haroenv
Haroenv / isjs-react-hooks.js
Created September 5, 2019 08:36
React InstantSearch, but made with InstantSearch connectors & hooks
/* eslint-disable react/prop-types, require-await, no-console */
import ReactDOM from 'react-dom';
import React, {
useEffect,
useState,
useRef,
createContext,
useContext,
} from 'react';
import instantsearch from '../es';

Migrate from v2 to v3

We are preparing to integrate the Helper directly inside InstantSearch, and for this are making some breaking changes. If you are happy using the current version of the Helper, there's no pressing need for you to upgrade to the next version.

Lodash

We have fully migrated away from lodash in v3. This means that there are some cases which used to accept incorrect shapes (objects where it should be arrays) will throw errors now.

URL sync

@Haroenv
Haroenv / removal-notes.md
Last active May 13, 2019 15:21
lodash removal notes: React InstantSearch
  • omit

    • called on searchState
    • likely can use the babel version or spread instead
  • isEqual

    • only three usages
    • deep equal on props
  • used in maps too