Skip to content

Instantly share code, notes, and snippets.

Avatar

Wendell Misiedjan ItsWendell

View GitHub Profile
@ItsWendell
ItsWendell / with-next-link.ts
Created Jul 22, 2021
withNextLink - Higher Order Component for Linkable components to support Next.JS Routing / Links
View with-next-link.ts
@ItsWendell
ItsWendell / PLPGSQL-nanoid.sql
Created May 4, 2021
NanoID Implementation in PL/pgSQL for Postgres.
View PLPGSQL-nanoid.sql
-- Highly performant NanoID implementation in PL/pgSQL.
--
-- NOTE: This is a concept implementation, hasn't been battle tested.
--
-- Version: 0.1
-- Inspired by https://github.com/Jakeii/nanoid-postgres
-- @author github.com/ItsWendell
CREATE OR REPLACE FUNCTION gen_nanoid(size int DEFAULT 21)
RETURNS text AS $$
@ItsWendell
ItsWendell / segment-analytics.ts
Last active Apr 13, 2021
Segment Analytics client for Lambda with Fire & Forget support.
View segment-analytics.ts
import { merge } from "lodash";
import { request } from "https";
import { v4 as uuidv4 } from "uuid";
export const name = "analytics-lamdba";
export const version = "0.1.2";
export type SegmentMessageTypes =
| "identify"
| "group"
@ItsWendell
ItsWendell / setCacheControl.ts
Created Jun 14, 2020
Helper function for setting cache control from HTTP server responses
View setCacheControl.ts
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 Feb 26, 2020
React Hooks: Algolia Places component with custom input field and support for initial value. (places.js)
View algolia-places-component.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,