kubernetes-cli (v1.10.3) taken as example
- Downgrade Homebrew to the commit which upgrades the formula to the specific version that we want
$ cd "$(brew --repo homebrew/core)"
$ git log Formula/kubernetes-cli.rb
...
| // ======================================= App.tsx ============================================= | |
| import App from "next/app"; | |
| import type { AppContext, AppProps } from "next/app"; | |
| import Script from "next/script"; | |
| import Router from "next/router"; | |
| import NProgress from "nprogress"; | |
| import { getIronSession } from "iron-session"; | |
| import { AuthProvider } from "../context/authContext"; |
| import { useLayoutEffect, useCallback, useState } from 'react' | |
| export const useRect = (ref) => { | |
| const [rect, setRect] = useState(getRect(ref ? ref.current : null)) | |
| const handleResize = useCallback(() => { | |
| if (!ref.current) { | |
| return | |
| } |
| const [progressInfos, setProgressInfos] = useState({ val: [] }) | |
| const progressRef = useRef(null) | |
| const [uploadError, setUploadError] = useState(null) | |
| const [uploadVideo] = useMutation( | |
| gql` | |
| mutation UploadVideo($input: UploadVideoInput!) { | |
| uploadVideo(input: $input) { | |
| id | |
| } |
TLDR: Use for...of instead of forEach in asynchronous code.
Array.prototype.forEach is not designed for asynchronous code. (It was not suitable for promises, and it is not suitable for async-await.)
For example, the following forEach loop might not do what it appears to do:
| [user] | |
| email = [email protected] | |
| name = Igor ESCHALIER | |
| [alias] | |
| co = checkout | |
| br = branch | |
| sts = status --short | |
| last-log = log -5 --pretty --oneline | |
| who = shortlog -sn |
| echo '.env' >> .gitignore | |
| git rm -r --cached .env | |
| git add .gitignore | |
| git commit -m 'untracking .env' | |
| git push origin master |
Magic words:
psql -U postgresSome interesting flags (to see all, use -h or --help depending on your psql version):
-E: will describe the underlaying queries of the \ commands (cool for learning!)-l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)