Skip to content

Instantly share code, notes, and snippets.

View x3r0s's full-sized avatar
๐Ÿ 
Working from home

David Kim x3r0s

๐Ÿ 
Working from home
View GitHub Profile
@x3r0s
x3r0s / 1inchAPIComment.js
Last active July 14, 2022 09:37
TDI ํ”„๋กœ์ ํŠธ Web3 1inch API ์˜ˆ์ œ ์ฝ”๋“œ์— ์„ค๋ช… ์ฃผ์„์„ ์ถ”๊ฐ€ํ•œ JS ๋ฌธ์„œ์ž…๋‹ˆ๋‹ค.
// ๋ชจ๋“ˆ Import, ์‹ค์ œ ์‚ฌ์šฉ์—์„œ๋Š” fetch, yesno ๋ชจ๋“ˆ์€ ์ œ๊ฑฐ๋˜๋ฉฐ Web3 Module์€ etherjs ๋ชจ๋“ˆ๋กœ Migration ๋จ
// Migration ๋ฐฉ๋ฒ•์— ๊ด€๋ จ๋œ ๋ฌธ์„œ๋Š” https://docs.ethers.io/v5/migration/web3/ ์ฐธ๊ณ 
const Web3 = require('web3'); // Migration to etherjs
const fetch = require('node-fetch'); // Migration to Axios
// ๋„คํŠธ์›Œํฌ ์ฒด์ธ ID ์„ค์ •
const chainId = 56;
// Web3 RPC URL ์„ค์ •, ์ถ”ํ›„ web3 provider์— ์ธ์ž๋กœ ๋“ค์–ด๊ฐ
const web3RpcUrl = 'https://bsc-dataseed.binance.org';
@x3r0s
x3r0s / Next.js-Responsive-Image.js
Created May 3, 2022 01:57
Next.js <Image> & tailwind ๋ฐ˜์‘ํ˜• ์ด๋ฏธ์ง€ ์ œ๊ณตํ•˜๋Š” ๋ฐฉ๋ฒ•
import Image from 'next/image'
<div>
<div className="md:hidden">
<Image src="Banner-767x500.webp" height={500} width={767} />
</div>
<div className="hidden md:inline-flex lg:hidden">
<Image src="Banner-1023x500.webp" height={500} width={1023} />
</div>
<div className="hidden lg:inline-flex xl:hidden">
@x3r0s
x3r0s / PM2-Command.md
Created February 8, 2022 16:53
PM2 Command

Change Process name

pm2 restart {id} --name {New name}

@x3r0s
x3r0s / shuffle.js
Created January 6, 2022 08:45
JavaScript Shuffle Prototype
// https://im-first-rate.tistory.com/35?category=827433
// Array์˜ prototype์„ ์ง€์ •ํ•ด์ฃผ๊ณ , shuffle์ด๋ผ๋Š” ์ด๋ฆ„์„ ๊ฐ€์ง„ ํ•จ์ˆ˜๋ฅผ ์ƒ์„ฑ
Array.prototype.shuffle = function () {
var length = this.length;
// ์•„๋ž˜์—์„œ length ํ›„์œ„ ๊ฐ์†Œ ์—ฐ์‚ฐ์ž๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด์„œ ๊ฒฐ๊ตญ 0์ด๋œ๋‹ค.
// ํ”„๋กœ๊ทธ๋ž˜๋ฐ์—์„œ 0์€ false๋ฅผ ์˜๋ฏธํ•˜๊ธฐ์— 0์ด๋˜๋ฉด ์ข…๋ฃŒ.
while (length) {
@x3r0s
x3r0s / index.html
Created December 3, 2021 07:20
Search bar with search icon
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css" />
</head>
@x3r0s
x3r0s / common.css
Last active December 3, 2021 07:19
no-drag.css
/* ๊ธ€์”จ ๋“œ๋ž˜๊ทธ๋ฅผ ๋ง‰์•„์ฃผ๋Š” css */
.no-drag {
-ms-user-select: none;
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
user-select: none;
}
@x3r0s
x3r0s / sharphr.css
Created November 24, 2021 08:41
sharp <hr> tag
hr {
border-width:1px 0px 0px 0px;
border-style:solid;
border-color:#808080;
opacity: 0.3;
height:1px;
}
@x3r0s
x3r0s / noBlankBetweenImg.css
Created November 22, 2021 05:30
<img>, <br> ํƒœ๊ทธ ์—ฌ๋ฐฑ ์ œ๊ฑฐ css
.target li br {
content: "";
display: block;
margin-bottom: -4px;
}
.target li img{
width:100%;
border:0;
}
@x3r0s
x3r0s / gl-Material-icons.html
Created November 22, 2021 01:21
Google Material Icons
<link href="https://fonts.googleapis.com/css?family=Material+Icons|Material+Icons+Outlined|Material+Icons+Two+Tone|Material+Icons+Round|Material+Icons+Sharp" rel="stylesheet">
<!-- import any icon from here -->
<!-- https://fonts.google.com/icons -->
<span class="material-icons-outlined">done</span>
@x3r0s
x3r0s / center.css
Last active December 14, 2021 04:32
center css
/* ๋ถ€๋ชจ ๋ฐ‘์˜ ์ž์‹ div๋ฅผ ๋ถ€๋ชจ์˜ ์ „์ฒด๋„“์ด๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์ค‘์•™์ •๋ ฌ ํ•  ๋•Œ */
.target {
position: relative;
top: 50%;
left: 50%;
margin: 0 0 0 -480px;
width: 960px;
}
/* ์ฝ˜ํ…์ธ  ์ปจํ…Œ์ด๋„ˆ ์˜์—ญ์„ ์ •๋ ฌํ•  ๋•Œ ์‚ฌ์šฉํ•จ */