Skip to content

Instantly share code, notes, and snippets.

View shawngustaw's full-sized avatar
🇨🇦

Shawn Gustaw shawngustaw

🇨🇦
  • Los Angeles
View GitHub Profile
@shawngustaw
shawngustaw / DO_NOT_USE_EFFECT_OR_YOU_WILL_BE_FIRED_SKILL.md
Last active April 24, 2026 22:29
DO_NOT_USE_EFFECT_OR_YOU_WILL_BE_FIRED_SKILL.md
name you-might-not-need-an-effect
description Consult this skill whenever writing, editing, or reviewing React code that involves (or might involve) useEffect. Trigger on any React component work where you're tempted to reach for useEffect — including syncing state to other state, transforming data for rendering, responding to events, resetting state on prop changes, chaining state updates, initializing the app, notifying parent components, data fetching, or any "I want X to happen when Y changes" instinct. Also trigger when reviewing existing code that already uses useEffect. Treat useEffect as effectively banned — almost every use is a code smell with a simpler, more correct alternative, and every "just in case" Effect is the seed of the next race condition or infinite loop. Based on the React docs "You Might Not Need an Effect" and Alvin Sng's "Why we banned React's useEffect".

You Might Not Need an Effect

Treat useEffect as effectively banned. Not literally forbidden — there are a hand

import PropTypes from 'prop-types';
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type Defined<T> = T extends undefined ? never : T;
/**
* Get the type that represents the props with the defaultProps included.
*
* Alternatively, we could have done something like this:

Keybase proof

I hereby claim:

  • I am shawngustaw on github.
  • I am notsrg (https://keybase.io/notsrg) on keybase.
  • I have a public key ASC6XoXQJosU8oglN2VHEq1sWowWF9dsWWbZoLo1G3kjTgo

To claim this, I am signing this object:

@shawngustaw
shawngustaw / gist:3c60d311cb39190aa4990803786813ee
Created April 6, 2017 17:10
Testing opener is restricted
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Testing opener is restricted</title>
<meta name="description" content="Testing">
<meta name="author" content="Shawn Gustaw">
</head>
export PATH=$HOME/bin:/usr/local/bin:$PATH
export TERM="xterm-256color"
# path for python virtual envs
export WORKON_HOME=$HOME/.virtualenvs
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/sbin:$PATH"
export PYTHONPATH=$PYTHONPATH:/Users/securitycompass/SDElements/sdelements/sigma
let g:neocomplete#enable_at_startup = 1
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Plugin 'gmarik/vundle'
Plugin 'scrooloose/nerdtree.git'
Plugin 'davidhalter/jedi-vim.git'
from locust import HttpLocust, TaskSet, task
from random import choice
BULIST = ['bu1', 'bu2', 'bu3', 'bu4', 'bu5']
PROJLIST = ['proj1', 'proj2', 'proj3']
APPLIST = ['app1', 'app2', 'app3', 'app4', 'app5']
USERLIST = []
for i in range(1, 501):
@shawngustaw
shawngustaw / script.py
Last active June 17, 2016 17:08
Output parent -> children mapping of project releases in SDElements
import requests
import argparse
import urlparse
parser = argparse.ArgumentParser()
parser.add_argument("--url")
parser.add_argument("--token")
args = parser.parse_args()
@shawngustaw
shawngustaw / gist:0d6161249538bb618624
Last active October 15, 2017 16:24
How to Sideload Google Apps on CopperheadOS
Disclaimer: I am not associated with Copperhead and this is not supported by them WHATSOEVER, nor is this guaranteed to work.
This has worked for me though.
1. Download gapps from http://opengapps.org/
The Nexus 5 has uses ARM (not 64-bit) and cOS is currently running Android Marshmallow (6.0).
2. Download the latest version of TWRP (as of now v3.0)
https://dl.twrp.me/hammerhead/twrp-3.0.0-0-hammerhead.img.html