Skip to content

Instantly share code, notes, and snippets.

View anthowave's full-sized avatar
🏠
Working from home

anthowave

🏠
Working from home
View GitHub Profile
@anthowave
anthowave / useFilter.ts
Last active November 29, 2022 09:34
A react custom hook designed for querying data from API. (TypeScript)
import { useState, useReducer, useEffect } from 'react';
import { Nullable } from 'interfaces';
type SearchState<T> = {
results: Array<T>;
isSearching: boolean;
isError: boolean;
};
type SearchAction<T> =
| { type: 'FETCH_INIT' }
@anthowave
anthowave / useOutsideClick.ts
Last active September 20, 2022 09:49
useOutsideClick (TypeScript) - a custom react hook that handles outside click event of certain area. It also ignores click event on browser's scrollbar.
import { useEffect, RefObject } from 'react';
/**
* Hook that handles outside click event of the passed refs
*
* @param refs array of refs
* @param handler a handler function to be called when clicked outside
*/
export default function useOutsideClick(
refs: Array<RefObject<HTMLElement> | undefined>,
@anthowave
anthowave / Gemfile
Created June 25, 2020 12:03 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@anthowave
anthowave / vscExtensions.md
Last active June 23, 2020 13:53
Favorite VSCExtensions

Keybase proof

I hereby claim:

  • I am anthowen on github.
  • I am anthowen (https://keybase.io/anthowen) on keybase.
  • I have a public key ASAmE0avnfMrHgBJsztetVeYwduvdAJAEVOgvKoLlVCxswo

To claim this, I am signing this object: