This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {DependencyList, useCallback, useRef} from "react"; | |
interface AnyFn<ReturnType> { | |
(...args: any[]): ReturnType; | |
} | |
/** Gives you a func that you can call once. | |
* | |
* It will store the return value of the original call, and return that for subsequent calls. | |
* This is true even when the deps change. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Say you have a NodeJS program that uses AWS.EnvironmentVariables, | |
# and you want to call that with different profiles you have: | |
# | |
# use-profile <profile> node your-script.js | |
import os | |
import sys | |
from configparser import ConfigParser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# "Python" as an Alternative to Java. | |
# | |
# Given a list of words and a list of phone numbers, | |
# find all the ways that each phone number can be | |
# expressed as a list of words. | |
# http://www.flownet.com/ron/papers/lisp-java/ | |
# | |
# Here, you can find Peter Norvig's solution in CL: | |
# http://www.norvig.com/java-lisp.html | |
# |