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
// vite.config.js - Optimized for <14kB chunks per https://endtimes.dev/why-your-website-should-be-under-14kb-in-size/ | |
// Aligns with TCP slow start to minimize latency; use Brotli for ~50kB uncompressed in 14kB delivered. | |
// Install: npm install vite-plugin-compression --save-dev | |
import { defineConfig } from 'vite'; | |
import compression from 'vite-plugin-compression'; | |
export default defineConfig({ | |
plugins: [ | |
compression({ |
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
{ | |
"rules": [ | |
{ | |
"urlPattern": "https://shopee.ph/*", | |
"removeParams": ["sp_atk", "xptdk"] | |
} | |
] | |
} |
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
Certainly! Let's create more realistic test cases for each of the first seven functional methods, using scenarios related to vehicle, house, or land insurance. Each example will use an array with real-life-like data. | |
1. **forEach (Logging Vehicle Insurance IDs)**: | |
```javascript | |
const vehicleInsurances = [ |
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
import React, { useState } from 'react'; | |
interface JsonDisplayProps { | |
data: any; // You can use a more specific type based on what JSON you expect | |
} | |
const JsonDisplay: React.FC<JsonDisplayProps> = ({ data }) => { | |
const [isCollapsed, setIsCollapsed] = useState(true); | |
const jsonString = JSON.stringify(data, null, 2); | |
const truncateLimit = 100; // You can adjust the truncate limit as needed |
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 dataArray = ['A', 'B', 'C', 'D', 'E'] as const; | |
type data = [...(typeof dataArray)]; | |
type Last<T extends any[]> = T extends [...infer _, infer R] ? R : never; | |
const last: Last<data> = 'E' |
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
import React, { ReactNode } from 'react'; | |
interface ObjectProps { | |
[key: string]: any; | |
children?: ReactNode; | |
} | |
function objectToJSX(component: string, object: ObjectProps): JSX.Element { | |
if (typeof component !== 'string' || typeof object !== 'object') { | |
throw new Error('Invalid arguments provided.'); |
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
#!/bin/bash | |
# Build the Gatsby site | |
npm run build | |
# Create a new branch for the build files | |
git branch build-files | |
# Checkout the new branch | |
git checkout build-files |
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 got = require('got'); | |
const { parse } = require('parse5'); | |
const fs = require('fs'); | |
const searchText = process.argv[2]; | |
const listFile = process.argv[3] || 'list.txt'; | |
fs.readFile(listFile, 'utf8', (err, data) => { | |
if (err) throw err; | |
const websiteList = data.split('\n'); |
NewerOlder