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 const allCountries = { | |
AF: 'Afghanistan', | |
AX: 'Åland Islands', | |
AL: 'Albania', | |
DZ: 'Algeria', | |
AS: 'American Samoa', | |
AD: 'AndorrA', | |
AO: 'Angola', | |
AI: 'Anguilla', | |
AQ: 'Antarctica', |
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 { test, expect, chromium } from "@playwright/test"; | |
test("get started link long version", async () => { | |
// Open a browser | |
const browser = await chromium.launch(); | |
// Open a new page | |
const context = await browser.newContext(); | |
const page = await context.newPage(); |
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
const http = require("http"); | |
const PORT = 8088; | |
const HOST = "localhost"; | |
const server = http.createServer(function handleRequest(req, res) { | |
res.writeHead(200, { "Content-Type": "application/json" }); | |
res.end(JSON.stringify({ message: "hello world" })); | |
}); |
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
# Install dependencies only when needed | |
FROM node:lts-alpine AS deps | |
WORKDIR /opt/app | |
COPY package.json yarn.lock ./ | |
RUN yarn install --frozen-lockfile | |
# Rebuild the source code only when needed | |
# This is where because may be the case that you would try | |
# to build the app based on some `X_TAG` in my case (Git commit hash) |
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
.container { | |
overflow: auto; | |
display: flex; | |
scroll-snap-type: x mandatory; | |
} | |
.box { | |
height: 200px; | |
width: 200px; | |
background: red; |
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
function throttle (callback, limit) { | |
var wait = false; // Initially, we're not waiting | |
return function () { // We return a throttled function | |
if (!wait) { // If we're not waiting | |
callback.call(); // Execute users function | |
wait = true; // Prevent future invocations | |
setTimeout(function () { // After a period of time | |
wait = false; // And allow future invocations | |
}, limit); | |
} |
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
const debounce = (callback, wait) => { | |
let timeoutId = null; | |
return (...args) => { | |
window.clearTimeout(timeoutId); | |
timeoutId = window.setTimeout(() => { | |
callback.apply(null, args); | |
}, wait); | |
}; | |
} |
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 {Links,LiveReload,Meta,Outlet,Scripts,ScrollRestoration} from "remix"; | |
export default function App() { | |
return ( | |
<Document> | |
<Layout> | |
<Outlet /> | |
</Layout> | |
</Document> | |
); |
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
function CustomImage({...props}: ImageProps) { | |
const [src, setSrc] = React.useState(props.src); | |
return ( | |
<Image | |
onError={() => setSrc('/assets/image-error.png')} | |
placeholder="blur" | |
blurDataURL="/assets/image-placeholder.png" | |
{...props} | |
src={src} |
NewerOlder