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
| #!/usr/bin/env python3 | |
| """Inspect a known binary patch; modify only with --apply and a reviewed SHA-256. | |
| Supports thin, little-endian Mach-O arm64 and x86_64 executables only. Matching | |
| is heuristic: a unique instruction sequence is not proof of its purpose, and | |
| passing these checks does not establish compatibility with any CLI release. | |
| Quit the CLI and its updater before applying. Original bytes and mode are | |
| retained beside the target; ad-hoc signing changes the vendor signing identity. | |
| Only registered exact build hashes may be modified. The current profile covers | |
| one observed W2 local eligibility check; server-side acceptance unverified; |
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
| /* | |
| I wanted to update and listen to search param changes without installing any more libraries than neccessary. | |
| So, instead of installing `react-router-dom` just for its `useSearchParams` hook, I plucked some of their code. | |
| Their `useSearchParams` hook used `useNavigate` to update the url, and `LocationContext` wraps | |
| their `Routes` component, so I omitted those two as well | |
| */ | |
| import * as React from 'react'; | |
| import { SetSearchParams, SearchParamsChange } from 'interfaces/SearchParams'; |
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
| const map = { | |
| 0: 0, | |
| 1: 1, | |
| 2: 2, | |
| 3: 3, | |
| 4: 4, | |
| 5: 5, | |
| 6: 6, | |
| 7: 7, | |
| 8: 8, |
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
| // adapted from here: https://googlechrome.github.io/samples/network-information/ | |
| import React from 'react'; | |
| type TNetworkInfo = { | |
| type: string; | |
| downlink: string; | |
| rtt: string; | |
| downlinkMax: string; | |
| effectiveType: string; |
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
| // NOTE: This does NOT work on NextJS: https://github.com/vercel/next.js/discussions/19204 | |
| // Adapted from here: https://stackoverflow.com/questions/53464595/how-to-use-componentwillmount-in-react-hooks#comment101488609_56818036 | |
| const useComponentWillMount = (func: (...params: any[]) => any): void => { | |
| const willMount = useRef(true); | |
| useEffect(() => { | |
| // invert flag to ensure `func` does not run twice after mount | |
| willMount.current = false; | |
| }, []); |
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
| export const hexToRgba = (rgbaColor: string, opacity: number): string => | |
| `rgba(${parseInt(rgbaColor.substring(1, 3), 16)}, ${parseInt(rgbaColor.substring(3, 5), 16)}, ${parseInt( | |
| rgbaColor.substring(5, 7), | |
| 16, | |
| )}, ${opacity})`; | |
| // example usage: | |
| // hexToRgba(#FFFFFF, 0.5) -> 'rgba(255, 255, 255, 0.5)' |
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
| // This preloads images AFTER DOM has loaded | |
| // See PreloadedImages.tsx for loading images before DOM is ready (https://gist.github.com/mkhoussid/d6a1a7b3d029c42bbcb45bdc929602c8) | |
| import React from 'react'; | |
| export default function usePreloadImages(imageUrls: string[]): void { | |
| React.useEffect(() => { | |
| imageUrls.forEach((imageUrl) => { | |
| const image = new Image(); | |
| image.src = imageUrl; |
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
| // This preloads images BEFORE DOM has loaded | |
| // See usePreloadImages.ts for loading images after DOM has loaded (https://gist.github.com/mkhoussid/c960ba200d6ef9142b80769a7c84e5f1) | |
| import React from 'react'; | |
| type TPreloadImages = { | |
| imageUrls: string[]; | |
| }; | |
| export default React.memo(({ imageUrls }: TPreloadImages) => { | |
| return ( |
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
| /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| // https://codesandbox.io/s/hopeful-williams-ntsqk?file=/src/components/PhoneInput/index.tsx:0-2307 | |
| /////////////////////////////////////////////////////////////////////////////////////////////////// | |
| import React from "react"; | |
| import { Input, Select, Button } from "antd"; | |
| import countries, { getNames } from "i18n-iso-countries"; | |
| import { | |
| AsYouType, | |
| getCountryCallingCode, |
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
| ///////////////////////////////////////////////////////////////////////////// | |
| // https://codesandbox.io/s/inspiring-thunder-dzyi8?file=/src/index.tsx:0-274 | |
| ///////////////////////////////////////////////////////////////////////////// | |
| import * as React from "react"; | |
| import { Button } from "components/ui"; | |
| import { ThemeContext } from "contexts/ThemeContext"; | |
| import { themes } from "utils/theme"; | |
| import { Container, Label, RadioInputStyled } from "components/styled/App"; |
NewerOlder