Skip to content

Instantly share code, notes, and snippets.

View whoisYeshua's full-sized avatar
🏠
Working from home

whoisYeshua

🏠
Working from home
View GitHub Profile
@whoisYeshua
whoisYeshua / .npmrc
Last active February 4, 2025 18:37
NPM custom registry and how to set them
# npm config set //nexus.example.com/npm-all/:_auth=$(echo -n 'test:1234' | base64)
//nexus.example.com/npm-all/:_auth=dGVzdDoxMjM0
# npm config set //nexus.example.com/npm-releases/:_auth=$(echo -n 'test:1234' | base64)
//nexus.example.com/npm-releases/:_auth=dGVzdDoxMjM0
# npm config set @myco:registry=http://nexus.example.com/npm-releases/
@myco:registry=http://nexus.example.com/npm-releases/
# npm config set registry https://nexus.example.com/npm-all/
registry=https://nexus.example.com/npm-all/
@whoisYeshua
whoisYeshua / zoom-check.html
Created October 4, 2024 09:23
CSS Zoom Check
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Check zoom</title>
<style>
.zoom2 {
zoom: 2;
@whoisYeshua
whoisYeshua / buildUmd.js
Created June 11, 2024 05:37
Build ESM to UMD
import { transformFile } from '@swc/core'
import { writeFile } from 'node:fs/promises'
import { resolve } from 'node:path'
/** @type {import('@swc/core').Options} */
const baseSwcOptions = {
jsc: {
target: 'es2022',
parser: {
syntax: 'ecmascript',
@whoisYeshua
whoisYeshua / Reconciliation.tsx
Last active August 8, 2024 10:42
React Reconciliation
import { useState, useMemo, useReducer, memo } from "react";
const MyButton = memo(() => {
const value = useMemo(() => Math.random(), []);
return <button>MyButton {value}</button>;
});
export default function MyApp() {
const [flag, setFlag] = useState(false);
@whoisYeshua
whoisYeshua / Troubles-not-ok.tsx
Created April 11, 2024 08:37
Troubles-not-ok
import React, { memo, useEffect, useMemo, useState } from "react";
import { Divider, Header, List, Image, Grid } from "semantic-ui-react";
type TMovie = {
id: string;
previewLink: string;
name: string;
year: string;
description: string;
rate: string;
@whoisYeshua
whoisYeshua / importmap.json
Created March 23, 2024 04:53
Dynamic importmap content loading from JSON file
{
"imports": {
"react": "https://esm.sh/stable/[email protected]/es2022/react.mjs",
"react-dom/client": "https://esm.sh/stable/[email protected]/es2022/client.js"
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Number(str) vs +str</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@whoisYeshua
whoisYeshua / index.html
Created January 12, 2022 10:23
[...str] vs Array.from(str) (http://jsbench.github.io/#559a59d681819d0d41351eb1fa605a5c) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>[...str] vs Array.from(str)</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@whoisYeshua
whoisYeshua / index.html
Created January 10, 2022 19:31
Filter with has vs Filter with includes (http://jsbench.github.io/#cb72bdec400ae1f1f6036ceb65bcc7cb) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Filter with has vs Filter with includes</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>