Skip to content

Instantly share code, notes, and snippets.

View vanduc1102's full-sized avatar
🐛
💯 💯 💩 😆 🐢

Duke Nguyen vanduc1102

🐛
💯 💯 💩 😆 🐢
View GitHub Profile
@vanduc1102
vanduc1102 / spotless-pom.xml
Last active August 9, 2022 07:43
google code format with spotless
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.24.0</version>
<configuration>
<formats>
<format>
<includes>
<include>*.md</include>
<include>.gitignore</include>
@vanduc1102
vanduc1102 / api.http
Created March 2, 2022 05:20
How to upload file to PreSignedUrl with vscode REST Client
@baseUrl = {{$dotenv SERVICE_API_ENDPOINT}}
@accessToken = {{$dotenv SERVICE_API_ACCESS_TOKEN}}
### Health-check
GET {{baseUrl}}/health
### Media
### Create media upload url
## This endpoint return a JSON { data : "signedUrl" }
const NUMERALS = [
{ value: 1000000000000000000000, str: 'sextillion' },
{ value: 1000000000000000000, str: 'quintillion' },
{ value: 1000000000000000, str: 'quadrillion' },
{ value: 1000000000000, str: 'trillion' },
{ value: 1000000000, str: 'billion' },
{ value: 1000000, str: 'million' },
{ value: 1000, str: 'thousand' },
{ value: 100, str: 'hundred' },
{ value: 90, str: 'ninety' },
// AVN TOKEN
pragma solidity ^0.6.12;
// SPDX-License-Identifier: MIT
interface IERC20 {
@vanduc1102
vanduc1102 / logger.ts
Last active July 3, 2021 05:56
Winston3 Logger with custom namespace
const { LOG_LEVEL, APP_ENV } = process.env;
const logFormatter = APP_ENV === 'dev'
? format.combine(
winston.format.timestamp(),
winston.format.colorize(),
winston.format.printf((meta: any) => {
const { level, message, timestamp, namespace, stack, ...restMeta } = meta;
const displayNamespace = namespace ? `[${namespace}] -` : '';
const stackMessage = stack ? `\n${stack}` : '';
@vanduc1102
vanduc1102 / NFT.md
Created June 12, 2021 17:16
Ví dụ về NFT token

Non-fungible token ( NFT)

ERC-721 Token

NTF Websites

Beeple | The First 5000 Days

// contracts/GLDToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract ERC20_Token_Sample is ERC20, ERC20Burnable {
constructor() ERC20("ERC20 Token Sample1", "Sample 1") {
@vanduc1102
vanduc1102 / content.js
Last active December 26, 2020 06:37
Jest testing DOM in Node
const fetch = require('node-fetch');
async function getContent(url, originRequest) {
console.log('Getting content from: ', url);
const { redirectUrl } = originRequest.query;
const { host, ...remainingHeaders } = originRequest.headers;
return fetch(url, {
method: originRequest.method,
headers: { ...remainingHeaders},
rejectUnauthorized: false
@vanduc1102
vanduc1102 / git_rebase.bash
Created September 12, 2020 15:42
Git rebase, assumed that you are working on branchA
BranchA : // Commit verything
BranchA : git fetch origin master:master
BranchA : git rebase master
// If no conflicts, you are lucky
// possible there are some conflicts ==> RESOLVE theme
BranchA : git add all_conflicts_files
BranchA: git rebase --continue
@vanduc1102
vanduc1102 / tut.md
Last active August 28, 2020 17:26
Add missing AMP scripts to Wordpress HTML HEAD

ISSUE

The tag 'amp-accordion extension .js script' appears more than once in the document. This will soon be an error.

The tag 'amp-carousel extension .js script' appears more than once in the document. This will soon be an error.

Reason

AMPforWP is using AMP as dependencies, AMP will add amp-scripts base on the Post content somehow at some senarios, it cant add the amp-scripts, so missing script error will appear on the AMP validator.