Skip to content

Instantly share code, notes, and snippets.

View chrisdhanaraj's full-sized avatar

Chris Dhanaraj chrisdhanaraj

View GitHub Profile
@chrisdhanaraj
chrisdhanaraj / example.tsx
Created September 21, 2022 17:02
Example
const TableWrapper = ({
someProperty,
otherProperty
}) => {
const [data, loading] = useQuery({
variables: {
someProperty,
otherProperty
}
});
@chrisdhanaraj
chrisdhanaraj / osx.ahk
Last active September 16, 2022 00:02
Autohotkey script to bring OSX keybinds to Windows
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
LCtrl & Tab:: AltTab
!Tab:: Send ^{Tab}
!+Tab:: Send ^+{Tab}
^Space:: Send ^{Esc}
@chrisdhanaraj
chrisdhanaraj / statechart.md
Last active July 1, 2021 03:05
Figuring out the state chart

When I press (Add Window)

  • Always blank!

When I press (Edit Window)

  • When I press edit window

--- If I've selected a mID - Find window id's, if all match, show those

  • Find window id's, if not all match, show blank

interface RolledUpWindow { ... propertiesofAWindow associatedWindowIds: [--> viewableIds] }

{ rgts_searchDealWindow: { dealEntries: { ... on Show {

@chrisdhanaraj
chrisdhanaraj / filterbar.md
Last active May 24, 2021 00:02
Descrbing the filter bar

Filter Bar

Allow a user to type to either

A) Filter available keys by name B) Filter available keys by validation C) Filter available values for defined lists

import { useEffect } from 'react';
export function useOutsideClick(containerRef, triggerRef, cb) {
function isOutsideClick(evt) {
if (
(containerRef.current !== null &&
containerRef.current.contains(evt.target)) ||
(triggerRef !== null && triggerRef.current.contains(evt.target))
) {
return cb({
@chrisdhanaraj
chrisdhanaraj / useSearch.tsx
Last active February 17, 2020 23:28
Use Redicer with Side Effects example
import useReducerWithSideEffects, {
NoUpdate,
Update,
UpdateWithSideEffect,
Reducer,
ReducerReturn
} from 'use-reducer-with-side-effects';
import { useCallback, useEffect, useContext } from 'react';
const initialStateArgs = {
interface Query {
queryString: string,
variables: {
[key]: string;
}
}
function convertToQuery({
query,
queries,
// Type definitions for use-reducer-with-side-effects 0.4
// Project: https://github.com/baz/foo (Does not have to be to GitHub, but prefer linking to a source code repository rather than to a project website.)
// Definitions by: Chris Dhanaraj <https://github.com/chrisdhanaraj>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/*~ If this module has methods, declare them as functions like so.
*/
type SideEffectArguments = {
state: any;
@chrisdhanaraj
chrisdhanaraj / machine.js
Last active July 16, 2019 21:35
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions