Skip to content

Instantly share code, notes, and snippets.

View Neo42's full-sized avatar
:shipit:

Johnny (Hao) Jiang Neo42

:shipit:
View GitHub Profile
@Neo42
Neo42 / react-performance-recipes.md
Last active January 8, 2022 11:01
React performance recipes

React Performance Recipes

Problem: Unnecessary Callback Re-Initiation

When you're using a callback function within useEffect, it's hard to predict how callback function will be modified in the future. Only passing in certain variables from the callback to the deps list won't do. Because once the variables passed in gets removed, your dependencies won't work any more. But you still have to provide some values to the dependency list to sync useEffect with the callback change.

const updateLocalStorage = () => window.localStorage.setItem('count', count)
React.useEffect(() => {
 updateLocalStorage()
@se79419ed
se79419ed / glassdoor.txt
Created January 7, 2021 15:39
bookmarklet to remove hardsell overlay from glassdoor.com
javascript:(function(){
document.getElementsByClassName('hardsellOverlay')[0].remove();
document.getElementsByTagName("body")[0].style.overflow = "scroll";
let style = document.createElement('style');
style.innerHTML = `
#LoginModal {
display: none!important;
}
`;
document.head.appendChild(style);
@judaew
judaew / keychron_k2.adoc
Last active May 10, 2024 13:39
Keychron K2 Manual

Keychron K2 Manual

Connect Bluetooth

On the side of the keyboard, switch the toggle to Bluetooth. Press fn+1 3 seconds and pair with device named Keychron K2.

  • fn+1 connect to 1st device

  • fn+2 connect to 2nd device

  • fn+3 connect to 3rd device

@getify
getify / monads-and-friends.md
Created July 16, 2020 19:38
Monads and Friends...

Monads and Friends...

Over the last 24-48 hours, I've fielded quite a flurry of tweets related to a couple of threads I posted recently. Upon reflection on the feedback, especially the negative stuff, I decided to write this blog post to clarify a few things about my background on the topic, what I was trying to say, what I've done so far, and what I'm hoping to do (and learn!) in the future.

It's a bit of a lengthy read, but if you find you've got the time, I hope you'll read it.

To be clear, the feedback has been on a broad spectrum. A lot of it was actually quite positive, people thanking me and appreciating my continued efforts to try to make dev topics approachable. As a matter of fact, over the years, I've received boat loads of such positive feedback, and I'm tremendously grateful that I've had a helpful impact on so many lives.

But some of it veered decidedly the other direction. I'm deliberately not linking to it, because I don't want to either amplify or gang up on those folks. I'm offended an

// copy this massive script in your console on the github page where the calendar is shown
// copy this massive script in your console on the github page where the calendar is shown
// copy this massive script in your console on the github page where the calendar is shown
// threejs.org/license
(function(k,ua){"object"===typeof exports&&"undefined"!==typeof module?ua(exports):"function"===typeof define&&define.amd?define(["exports"],ua):(k=k||self,ua(k.THREE={}))})(this,function(k){function ua(){}function v(a,b){this.x=a||0;this.y=b||0}function ya(){this.elements=[1,0,0,0,1,0,0,0,1];0<arguments.length&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}function W(a,b,c,d,e,f,g,h,l,m){Object.defineProperty(this,"id",{value:ej++});this.uuid=O.generateUUID();
this.name="";this.image=void 0!==a?a:W.DEFAULT_IMAGE;this.mipmaps=[];this.mapping=void 0!==b?b:W.DEFAULT_MAPPING;this.wrapS=void 0!==c?c:1001;this.wrapT=void 0!==d?d:1001;this.magFilter=void 0!==e?e:1006;this.mi
import hotkeys, { HotkeysEvent } from 'hotkeys-js';
import { useEffect, useCallback } from 'preact/hooks';
/**
* A Preact hook for triggering side-effects when pressing hotkeys.
*
* @param keys A comma-separated list of hotkeys to trigger the callback on.
* @param callback A callback function to execute when keys are pressed.
* @param dependencies A list of dependencies.
*/
{
"suggest.noselect": false,
"coc.preferences.formatOnSaveFiletypes": [
"javascript",
"typescript",
"typescriptreact",
"json",
"javascriptreact",
"typescript.tsx",
"graphql"
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'scrooloose/nerdtree'
"Plug 'tsony-tsonev/nerdtree-git-plugin'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'ryanoasis/vim-devicons'
Plug 'airblade/vim-gitgutter'
@tatianamac
tatianamac / tatiana-mac-speaker-rider.md
Last active March 24, 2024 12:22
Tatiana Mac's Speaker Rider

Speaker Rider

by Tatiana Mac

Last updated 14 April 2021

What is a speaker rider?

As speaking comes with immense privilege, I have crafted a speaker rider to set expectations and boundaries around my engagement. I am grateful to all the conference organisers who have brilliantly hosted me. I would love to continue to exercise this privilege to speak at conferences, and use this privilege to make the landscape more accessible and beneficial to tech's most historically excluded and marginalised communities.

Considerations

😫 I provide a lot of explanations for those of you who never had to consider these things. Most thoughtful conferences I've attended check most of these boxes intrinsically, particularly when conference runners are experienced speakers. They get it.

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Font
:set guifont=Source\ Code\ Pro:h14
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Hide pointless junk at the bottom, doesn't work in .vimrc for some reason?
:set laststatus=0
:set noshowmode "don't show --INSERT--
:set noruler "don't show line numbers/column/% junk