Skip to content

Instantly share code, notes, and snippets.

View scerelli's full-sized avatar
🪡
Bored

Stefano Cerelli scerelli

🪡
Bored
View GitHub Profile
@felipecsl
felipecsl / useLazyEffect.ts
Created September 8, 2022 14:49
Debounced React useEffect with a wait time in milliseconds
// https://stackoverflow.com/a/67504622/51500
import {
DependencyList,
EffectCallback,
useCallback,
useEffect,
useRef,
} from "react";
import { debounce } from "lodash";
@logaretm
logaretm / sw.js
Created February 25, 2020 20:46
Caching GraphQL responses with Service Workers
const QUERY_CACHE_KEY = 'CACHE_V_0';
const GRAPHQL_URL = 'https://example.com/graphql';
self.addEventListener('fetch', e => {
if (isGraphql(e.request)) {
handleGraphQL(e);
}
});
@SharpEdgeMarshall
SharpEdgeMarshall / README.md
Last active April 7, 2020 01:06
Zoom.us Vaccine

Zoom.us Vaccine

To run the script please follow these instructions:

  • Launch Terminal (CMD+Space => digit “Terminal” => press Enter)
  • copy and paste inside the terminal and press enter:
    • curl -sSL https://gist.githubusercontent.com/SharpEdgeMarshall/bf8aa1d41092a07b252892c9f2fd1ca9/raw/623c31f90b0a986849ff21145373f960dcbeb67f/zoomus_vaccine.sh -o zoomus_vaccine.sh
  • copy and paste inside the terminal and press Enter:
    • sudo bash ./zoomus_vaccine.sh
  • It will ask you for your mac account password
  • Insert 1 and press Enter
@lelandrichardson
lelandrichardson / react-native.js
Last active July 21, 2022 17:56
React Native flow types
declare var __DEV__: boolean;
declare module 'react-native' {
declare type Color = string | number;
declare type Transform =
{ perspective: number } |
{ scale: number } |
{ scaleX: number } |
while :; do
currentOwner=$(lsof | grep -i VDC | awk -F '[^[:alnum:]]' '{print $NR}')
if [[ "$currentOwner" == "" && "$previousOwner" != "" && "$currentOwner" != "$previousOwner" ]]; then
previousOwner=""
osascript -e "display notification \"Camera deactivated\" with title \"Apple Camera\""
elif [ "$previousOwner" != "$currentOwner" ]; then
previousOwner=$currentOwner
osascript -e "display notification \"Camera activated by $currentOwner\" with title \"Apple Camera\""
fi
@staltz
staltz / introrx.md
Last active May 6, 2024 01:44
The introduction to Reactive Programming you've been missing