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
// From <https://dev.to/dailydevtips1/react-cleaner-use-of-settimeout-105m> | |
import { useCallback, useEffect, useRef, useMemo } from 'react'; | |
/** | |
* To use the hook | |
* ``` | |
* import useTimeout from './useTimeout'; | |
* | |
* const [timeout] = useTimeout(() => { | |
* setShow(false); |
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
/* (320x480) iPhone (Original, 3G, 3GS) */ | |
@media only screen and (min-device-width: 320px) and (max-device-width: 480px) { | |
/* insert styles here */ | |
} | |
/* (320x480) Smartphone, Portrait */ | |
@media only screen and (device-width: 320px) and (orientation: portrait) { | |
/* insert styles here */ | |
} | |
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
javascript:function iptxt(){var d=document;try{if(!d.body)throw(0);window.location='http://www.instapaper.com/text?u=%27+encodeURIComponent(d.location.href);}catch(e){alert(%27Please wait until the page has loaded.%27);}}iptxt();void(0) |
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 React from 'react'; | |
function Layout1({ children }) { | |
return ( | |
<> | |
<main>{children}</main> | |
<footer> | |
By you | |
</footer> | |
</> |
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 { Skeleton } from '@mui/material'; | |
import { useTranslation } from 'next-i18next'; | |
import * as React from 'react'; | |
export interface Props { | |
textId: string; | |
width?: string; | |
} | |
/** |
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
// Copied for easier bookmarking from <https://github.com/vercel/next.js/issues/706#issuecomment-569041997> by @Lwdthe1 | |
// next.config.js | |
const aliasPathsToResolve = [ | |
{ name: 'components', path: path.resolve(__dirname, './components') }, | |
{ name: 'Common', path: path.resolve(__dirname, '../../common/react/') }, | |
] | |
module.exports = () => { | |
return { | |
webpack(config, { defaultLoaders }) { | |
config.module.rules.push({ |
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
export {}; | |
/** | |
* Extensions to the Typescript Date class. | |
*/ | |
declare global { | |
/** | |
* Extension members declarations. | |
*/ | |
interface Date { |
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
let observer = new IntersectionObserver( | |
(entries) => { | |
entries.forEach((entry, i) => { | |
if (entry.isIntersecting) { | |
const p = 2; | |
const c = document.createElement('canvas'); | |
const x = c.getContext('2d'); | |
c.width = 18; | |
c.height = 14; | |
const s = entry.target.innerText; |
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
// NodeJS based directory browsing and file serve without dependencies | |
// Joining code from <https://stackoverflow.com/questions/16333790/node-js-quick-file-server-static-files-over-http> | |
var fs = require("fs"), | |
http = require("http"); | |
http | |
.createServer(function (req, res) { | |
// Website you wish to allow to connect | |
res.setHeader("Access-Control-Allow-Origin", "*"); | |