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
interface Success<T> { | |
result: T | |
exception?: never | |
} | |
interface Failure { | |
result?: never | |
exception: {getError: () => unknown} | |
} |
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
You are an expert AI programming assistant that primarily focuses on producing clear, readable React and TypeScript code. | |
You always use the latest stable, modern version of TypeScript, JavaScript, React, Node.js, Tanstack React Router, Tanstack React Query, HeroUI (formerly NextUI), Tailwind CSS, Vitest and you are familiar with the latest features, best practices and standards. Remember to check `package.json` to see our libraries/packages and make the full use of them. | |
You keep your code clean, readable, and maintainable, fix all linting and formatting errors/warnings, and make sure the code is up to date with the latest standards. | |
You carefully, slowly and methodically, step by step, and outline your reasoning to provide accurate, factual, thoughtful answers, and are a genius at reasoning ai to chat, to generate Code Style, Structure, Naming Conventions, TypeScript Usage, UI and Styling, Performance Optimization. | |
You always check if a similar work has been done before, and if so, you would reference it to |
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' | |
declare module 'react' { | |
/* eslint-disable @typescript-eslint/no-explicit-any -- its intentional */ | |
/* | |
* Use this type to make sure that the callback passed will always be a memoized callback | |
* For any function type, wrap it with MemoizedCallback<T> | |
* Example: MemoizedCallback<(param: number) => boolean> | |
*/ | |
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type -- its intentional |
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
diff --git a/lib/utils/common.js b/lib/utils/common.js | |
index 90415975e33ea77d161df0329d3ed2426977c404..aa02006b46bb6a5d9143d8b86679e782a9fc06f7 100644 | |
--- a/lib/utils/common.js | |
+++ b/lib/utils/common.js | |
@@ -1,11 +1,14 @@ | |
-"use strict"; | |
+'use strict' | |
+ | |
+const {get} = require('http') | |
+const {type} = require('os') |
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
type Data = { | |
id: string; | |
}; | |
const data: Data = { | |
id: "123", | |
name: "Hello!", | |
} | |
const data2 = { |
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
export default function isolate<T extends (...args: unknown[]) => unknown>(fn: T): T { | |
// eslint-disable-next-line @typescript-eslint/no-implied-eval -- workaround | |
return new Function(` | |
with (new Proxy({}, { | |
has () { return true; }, | |
get (target, property) { | |
if (typeof property !== 'string') return target[property]; | |
throw new ReferenceError(property + ' accessed from isolated scope'); | |
}, | |
set (target, property) { |
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
export function detangle() { | |
let blocked = false | |
return callback => (...args) => { | |
if (blocked) return | |
blocked = true | |
callback(...args) |
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/sh | |
TARGET_DIR=node_modules | |
if [ ! -d $TARGET_DIR ]; then | |
echo "$TARGET_DIR" does not exist | |
exit 1 | |
fi | |
PATTERNS=" |
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
function bigIntToFloatString(value: bigint, decimalPlaces: number) { | |
if (typeof decimalPlaces !== 'number' || decimalPlaces < 0 || !Number.isInteger(decimalPlaces)) { | |
throw new TypeError('The second argument must be a non-negative integer'); | |
} | |
const divisor = BigInt(10 ** decimalPlaces); // 1e{decimalPlaces} | |
const integerPart = value / divisor; | |
const fractionalPart = value % divisor; |
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
Đầu tiên là phải hiểu đúng web3 là gì. Web3 có phải là blockchain không, hay là crypto? Web3.0 là Internet 3.0. Định nghĩa thì dài lắm nhưng cách hiểu nhanh nhất có thể được thể hiện qua sự so sánh của internet ở các thời kỳ như sau: | |
Web1.0 = 1 bên đăng, 1 bên đọc | |
Web2.0 = 2 bên đều có thể đọc và đăng nhưng 1 bên sở hữu, quản lý, hưởng lợi | |
(google, fb hạn chế 1 số chủ đề, bài viết chẳng hạn; thanh toán qua trung gian như sàn thương mại điện tử hoặc tài khoản ngân hàng) | |
Web3.0 = tất cả các bên đều có thể đọc, đăng, sở hữu, quản lý và hưởng lợi | |
(tự do tạo nội dung, tạo ra các loại app, thanh toán trực tiếp vào ví crypto và/hoặc thông qua smart contract). | |
Để hiểu đầy đủ, tường tận, bạn nên đọc kĩ bài viết này nhé: https://ethereum.org/en/web3/ | |
Có 1 số người tin rằng web3.0 là tương lai của internet, 1 số người thì nghĩ web3.0 là scam. 1 số còn lại nghĩ rằng web2.0 và web3.0 sẽ tồn tại song song. | |
Chúng ta đều có những nhận định của riêng mình. Vì vậy, sau khi hiểu rõ web3.0 là gì thì mình sẽ chuyển qua bước tiếp |
NewerOlder