Skip to content

Instantly share code, notes, and snippets.

View ItsWendell's full-sized avatar

Wendell Misiedjan ItsWendell

View GitHub Profile
@ItsWendell
ItsWendell / setCacheControl.ts
Created June 14, 2020 23:48
Helper function for setting cache control from HTTP server responses
import { ServerResponse } from "http";
interface CacheControlConfig {
sMaxAge?: number;
maxAge?: number;
staleWhileRevalidate?: boolean | number;
publicCache?: boolean;
privateCache?: boolean;
immutable?: boolean;
noCache?: boolean;
@ItsWendell
ItsWendell / algolia-places-component.js
Last active February 26, 2020 20:10
React Hooks: Algolia Places component with custom input field and support for initial value. (places.js)
import React, { useRef, useEffect } from 'react';
import places from 'places.js';
// Custom component for React implementation with Hooks for Places.js
const AlgoliaPlaces = ({
inputComponent = input,
placeholder,
options,
initialValue,