Deriving a new Array from an existing Array:
['■','●','▲'].slice(1, 3) ⟼ ['●','▲']
['■','●','■'].filter(x => x==='■') ⟼ ['■','■']
['▲','●'].map(x => x+x) ⟼ ['▲▲','●●']
['▲','●'].flatMap(x => [x,x]) ⟼ ['▲','▲','●','●']| import {DependencyList, useCallback, useEffect, useRef} from 'react'; | |
| export const useClickOutside = <T extends (...args: any[]) => any>( | |
| cb: T, | |
| dep: DependencyList | |
| ) => { | |
| const ref = useRef<HTMLElement>(null); | |
| // eslint-disable-next-line react-hooks/exhaustive-deps | |
| const callback = useCallback(cb, dep); |
| import { | |
| MouseEventHandler, | |
| RefObject, | |
| useCallback, | |
| useEffect, | |
| useRef, | |
| useState | |
| } from 'react'; | |
| export type DraggableHandler = (coords: [number, number]) => void; |
| import {useMemo} from 'react'; | |
| /** | |
| * Prevents React.DOM from replacing methods inside hooks. | |
| */ | |
| const ref = { | |
| log: console.log, | |
| error: console.error, | |
| debug: console.debug | |
| }; |
| /** | |
| * "document_id" -> "document id" | |
| * "documentId" -> "document id" | |
| */ | |
| export const toSpaces = (str: string): string => | |
| str && str | |
| .replace(/[-_]/g, ' ') | |
| .replace(/([A-Z])/g, ' $1'); | |
| /** |
This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project:
| <?php | |
| // set the output-file | |
| $outputfile = "/var/www/nyt/nyt.jpg"; | |
| // set path to todays NYT frontpage | |
| $pathToPdf="https://static01.nyt.com/images/".date('Y')."/".date('m')."/".date('d')."/nytfrontpage/scan.pdf"; | |
| // check if there is any today | |
| $file_headers = @get_headers($pathToPdf); |
This is definitely not the first time I've written about this topic, but I haven't written formally about it in quite awhile. So I want to revisit why I think technical-position interviewing is so poorly designed, and lay out what I think would be a better process.
I'm just one guy, with a bunch of strong opinions and a bunch of flaws. So take these suggestions with a grain of salt. I'm sure there's a lot of talented, passionate folks with other thoughts, and some are probably a lot more interesting and useful than my own.
But at the same time, I hope you'll set aside the assumptions and status quo of how interviewing is always done. Just because you were hired a certain way, and even if you liked it, doesn't mean that it's a good interview process to repeat.
If you're happy with the way technical interviewing currently works at your company, fine. Just stop, don't read any further. I'm not going to spend any effort trying to convince you otherwise.