Skip to content

Instantly share code, notes, and snippets.

View bobylito's full-sized avatar
🎩
JSing 🚀

Alex S bobylito

🎩
JSing 🚀
View GitHub Profile
@bobylito
bobylito / HowTo.md
Created April 13, 2024 15:08
Install NetBoot.xyz on FreshTomato

Install / use Netboot.xyz on a FreshTomato router

Prerequisites

  • FreshTomato based router (tested on 2024.1 on an ARM router)
  • a USB key (to store the file that will be served)

HowTo

@bobylito
bobylito / email.stories.tsx
Created October 13, 2023 05:12
React-email (resend) component in a StoryBook story
import { render } from "@react-email/render";
import type { Meta, StoryFn } from "@storybook/react";
import Email from "./email";
const meta: Meta<typeof Email> = {
title: "components/Email",
component: Email,
parameters: {
layout: "fullscreen",
},
@bobylito
bobylito / common-npm-script.md
Created February 1, 2018 15:12
RFC: a list of commands for NPM script in InstantSearch projects

Standardized NPM commands for InstantSearch libraries

Pattern using commands

  • command: used for main commands
  • command:sub_command: used for commands related to a bigger command (build:umd is for buildbing

There should not probably be a third level.

Common commands:

@bobylito
bobylito / Connector_usage.js
Created July 3, 2017 11:27
[instantsearch.js v2] Connector usage sample
// custom `renderFn` to render the custom Menu widget
function renderFn(menuRenderingOptions, isFirstRendering) {
if (isFirstRendering) {
menuRenderingOptions.widgetParams.containerNode
.html('<select></select');
menuRenderingOptions.widgetParams.containerNode
.find('select')
.on('change', function(event) {
menuRenderingOptions.refine(event.target.value);
@bobylito
bobylito / SimpleCustomSearchBox.js
Last active December 8, 2016 13:55
Simple custom SearchBox for react-instantsearch.
const MySearchBox = connectSearchBox(({currentRefinement, refine}) => {
return <input type="text" value={currentRefinement} onChange={(e) => refine(e.target.value)}/>;
});

AlgoliaSearch Helper - getting started - step 3

In this sample, we cover those topics:

  • how to declare a facet in the configuration of the helper
  • how to display the facet values computed by the API
  • how to refine a facet

See on jsFiddle

@bobylito
bobylito / _helper_gettingstarted_2.md
Last active June 24, 2016 13:21
Helper getting started, step 2: setting the query

AlgoliaSearch Helper - getting started - step 2

In this sample, we cover those topics:

  • how to set the query of the search
  • how to trigger the search
  • how to display highlighting to help our users
  • how to plug all these to make an interactive search

See on jsFiddle

@bobylito
bobylito / _helper_gettingstarted_1.md
Last active June 24, 2016 13:21
Helper getting started, step 1: first search

AlgoliaSearch Helper - getting started - step 1

In this sample, we cover those topics:

  • how to instanciate the helper
  • listen to the result event and read the results from Algolia
  • trigger a search to algolia

See on jsFiddle

search = instantsearch({});
search.addWidget({
getConfiguration: function(){
return {disjunctiveFacets: ['director']};
},
init: function(state){
state.addDisjunctiveFacetRefinement('director', 'Clint Eastwood');
}
})
@bobylito
bobylito / multilineTextHack.js
Created October 10, 2015 16:17
Multiline text hack from CSSNext cli
program.on("--help", function() {
console.log(function() {/*
Examples:
# pass an input and output file
$ cssnext input.css output.css
# start cssnext watcher (need input & output)
$ cssnext --watch input.css output.css
# using stdin and stdout
$ cat input.css | cssnext > output.css
*/