This file contains hidden or 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
| function createTuple<T extends any[]>(...args: T) { | |
| return args; | |
| } |
This file contains hidden or 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
| function useBoundEffect<TArguments extends any[]>( | |
| effect: (...params: TArguments) => ReturnType<React.EffectCallback>, | |
| getArguments: () => TArguments | |
| ) { | |
| const lastArguments = useRef<TArguments | undefined>(undefined); | |
| const lastEffectCleanup = useRef<ReturnType<React.EffectCallback>>(undefined); | |
| useEffect(() => { | |
| const newArguments = getArguments(); |
This file contains hidden or 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
| function CanvasComponent() { | |
| const canvasRef = useRef<HTMLCanvasElement | null>(null); | |
| useEffect(() => addTouchListener(canvasRef.current), [canvasRef.current]); | |
| return <canvas ref={canvasRef} />; | |
| } |
This file contains hidden or 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
| function CanvasComponent() { | |
| const canvasRef = useRef<HTMLCanvasElement | null>(null); | |
| useBoundEffect(addTouchListener, canvasRef.current); | |
| return <canvas ref={canvasRef} />; | |
| } | |
| function addTouchListener(canvas: HTMLCanvasElement | null) { | |
| if (!canvas) { |
This file contains hidden or 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
| function useBoundEffect<TArguments extends any[]>( | |
| effect: (...params: TArguments) => ReturnType<React.EffectCallback>, | |
| ...params: TArguments | |
| ) { | |
| return useEffect(() => effect(...params), params); | |
| } |
This file contains hidden or 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
| module.exports = { | |
| getSourceExts: () => [ 'jsx' ], | |
| }; |
This file contains hidden or 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
| public void FormsAuthentication_OnAuthenticate(object sender, FormsAuthenticationEventArgs args) | |
| { | |
| var machineKeySection = (MachineKeySection) WebConfigurationManager.GetWebApplicationSection("system.web/machineKey"); | |
| var cookie = args.Context.Request.Cookies[".ASPXAUTH"]; | |
| if (cookie == null || !Regex.IsMatch(cookie.Value, "^([a-fA-F0-9]{2})+$")) | |
| return; | |
| var cookieBytes = ByteUtility.ToBytes(cookie.Value); | |
| int signatureLength; |
This file contains hidden or 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
| using System; | |
| class Program | |
| { | |
| static void Main() | |
| { | |
| object obj = new object(); | |
| for (int i = 0; i < 2; i++) |