Skip to content

Instantly share code, notes, and snippets.

View MariusBongarts's full-sized avatar

Marius Bongarts MariusBongarts

View GitHub Profile
const path = require("path");
const CopyPlugin = require("copy-webpack-plugin");
module.exports = {
entry: "./src/index.tsx",
mode: "production",
module: {
rules: [
{
test: /\.tsx?$/,
function App() {
return (
<div>
<header>
<h5>Hello From React App 👋</h5>
</header>
</div>
);
}
<body>
<nav></nav>
<header></header>
<footer></footer>
</body>
<body>
<div class="nav"></div>
<div class="header"></div>
<div class="footer"></div>
</body>
@MariusBongarts
MariusBongarts / url.spec.ts
Created January 16, 2023 06:33
TDD ChatGPT
[
"https://medium.com/p/e5e9b232d990/edit",
// ...
].forEach(url => {
describe(`GIVEN I provide the url '${url}'`, () => {
it("THEN the url is blacklisted", async () => {
const isBlackListed = await urlIsBlacklisted(url);
expect(isBlackListed).toEqual(true);
});
});
export function playVideoWhenInViewport(videoElement: HTMLVideoElement) {
const viewportObserver = new IntersectionObserver(
(entries, _observer) => {
const videoIsVisible = entries[0].isIntersecting;
if (videoIsVisible) {
videoElement?.play();
}
},
{
root: document
location ~ ^/.*(woff|otf|jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp3|mp4|ogg|ogv) {
root /var/www/web-highlights;
gzip_static on;
expires 1y;
etag off;
if_modified_since off;
add_header Cache-Control "public, no-transform";
}
location / {
root /var/www/web-highlights;
try_files $uri /index.html;
gzip_static on;
}
plugins: [
new CompressionPlugin(),
// ...
]
const router = new Router({
mode: "history",
base: "/",
routes: [
{
path: "/",
component: () => import(`./views/LandingPage.vue`)
},
{
path: "/home",