Skip to content

Instantly share code, notes, and snippets.

View sbin0819's full-sized avatar
:octocat:
Working from home

sbin sbin0819

:octocat:
Working from home
View GitHub Profile

regex 활용 심화

핸드폰 format

 function phoneFomatter(num,type){
    var formatNum = '';
    if(num.length==11){
        if(type==0){
            formatNum = num.replace(/(\d{3})(\d{4})(\d{4})/, '$1-****-$3');
        }else{
 formatNum = num.replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3');
# Chapter 1
Web3.js
## basic
### 컨트랙트
```solidity
pragma solidity ^0.4.19;
docker run -d -p 5432:5432 --name postgres -e POSTGRES_PASSWORD=password postgres

plain js

document.getElementById('drag').ondragstart = function() {
  e.dataTransfer.setData('data', this.innerHTML); // 드래그해보세요 문자열 전달
};

document.getElementById('drop').ondragover = function(e) {
  e.preventDefault(); // 필수 이 부분이 없으면 ondrop 이벤트가 발생하지 않습니다.
};

Authentication

# POST in terminal
$ curl -X POST http://localhost:4000/auth/login -d '{"username": "john", "password": "changeme"}' -H "Content-Type: application/json"
curl http://localhost:4000/profile -H "Authorization: Bearer ey..."
@sbin0819
sbin0819 / gcd.js
Created June 30, 2022 02:47
최대공약수
let getGCD = (num1, num2) => {
let gcd = 1;
for(let i=1; i<=Math.max(num1, num2); i++){
if(num1 % i === 0 && num2 % i === 0){
gcd = i;
}
}
return gcd;
}
@sbin0819
sbin0819 / Hello World.py
Created June 30, 2022 02:39
Test Gist Connection
print("Hello World")