git checkout -- ./index.js
// 마지막 커밋 시의 상태로 되돌립니다.
git reset --hard
리모트 브랜치 가져오기
git remote update
Footnotes
-
명령어로 discard를 하려면 ↩
# 마지막 커밋 해시
git log --pretty=format:'%h' -n 1
# 유저정보
git config user.name
git config user.email
Using Slack Slash Commands to Send Data from Slack into Google Sheets
- 사람들이 추천한 책을 기록한다
- 슬랙 -> 구글시트
- 슬랙 커맨드 설정
/book
+ 구글앱스 스크립트 url 연결1 - POST로 전송 받은 데이터값을 기반으로 데이터 처리 완료
Footnotes
-
꿀벌개발일지 :: 구글 앱스 스크립트에서 비동기 작업 추가하기 doPost에서 비동기 처리 ↩
이미지 저장1
- 페이지에서 JavaScript를 통해 이미지 추출
- 캔버스에서 이미지 추출
- 서버에서 이미지 가져오기
- DevTools 프로토콜을 사용하여 이미지 추출
const tree = await page._client.send('Page.getResourceTree')
for (const resource of tree.frameTree.resources) {
const { content } = await page._client.send(
'Page.getResourceContent',
{ frameId: String(page.mainFrame()._id), url: resource.url },
)
const contentBuffer = Buffer.from(content, 'base64')
}
page.on('response', async (response) => {
const url = response.url()
const buffer = await response.buffer()
})
Footnotes
setExtraHTTPHeaders
호출하기
await page.setExtraHTTPHeaders(headers)
인터셉트로 가로채기
await page.setRequestInterception(true)
page.on('request', (request) => {
const headers = {
...request.headers()
}
interceptedRequest({ headers })
})
httpOnly, secure 플래그 쿠키값이 필요한 경우 CDPSession 실행 후 클라이언트와 통신한다.
const client = await page.target().createCDPSession()
const data = await client.send('Network.getAllCookies')
로컬에 해당 쿠키정보를 임시로 저장해서 재활용하고 만료 시 갱신하는 방법을 사용.
fs.writeFileSync('cookies.json', JSON.stringify(data))
const { cookies } = JSON.parse(fs.readFileSync('cookies.json', 'utf8'))
await page.setCookie(...cookies)
hash 링크로 연결될 경우 스크롤위치가 최상단으로 위치하기 때문에 문제(헤더가 고정일 경우)가 있을수도 있어서 scroll-margin-top
으로 제어가 가능한 부분을 설명하고 있다.
- Add scroll margin to all elements which can be targeted - Piccalilli1
- Fixed Headers and Jump Links? The Solution is scroll-margin-top | CSS-Tricks
- Prevent content from being hidden underneath a fixed header by using scroll-margin-top – Bram.us
Footnotes
-
2ex
유닛을 사용하여 선택한 글꼴의 x 높이의 상대적인 크기로 설정. ↩
function getReverseGeocodeData() {
const response = Maps.newGeocoder()
.setLanguage('ko')
.reverseGeocode(40.758577, -73.984464)
return response.results.map((result) => {
return {
formatted_address: result.formatted_address,
lat: result.geometry.location.lat,
lng: result.geometry.location.lng,
}
})
}
Cool Cats: The Coolest NFT’s on the Blockchain!
const imageSrc = `https://s3.amazonaws.com/api.coolcatsnft.com/thumbnails/${ID}_thumbnail.png`
const query = {
sortBy: 'token_id_asc',
limit: 48,
page: 1,
face: 'angry',
hats: 'admiral',
shirt: 'astro',
tier: 'cool_1',
}
fetch(
'https://prod-api.coolcatsnft.com/cat?sortBy=token_id_asc&limit=48&page=1&tier=${tier}'
)
- face angry, angry cute, angry scar, beard brown, beard pirate, beard tan, derp, ditto, dizzy, double face, face face, glasses, glasses funny, glossy, grin, happy, happy cute, hearts, mononoke, mummy, ninja black, ninja blue, ninja red, owo, pixel, rich, shocked, smirk, stunned, sunglasses blue, sunglasses cool, sunglasses cowboy, sunglasses heart, sunglasses pixel, sunglasses squad, sunglasses yellow, three eyes, tired, tvface 404, tvface bobross, tvface nosignal, tvface xp, unamused, uwu, wink, zombie
- hat admiral, admiral pink, afro black, afro brown, afro rainbow unicorn, antlers, apple, arrowhead, astro, astro cheeks, astro fishbowl, beanie black, beanie blue, beanie orange, beanie red, beret black, beret green, beret pink, beret red, bow, bucket hat blue, bucket hat green, bucket hat tan, bucket hat white, candle, costume dragon, costume frog, costume gorilla, cowboy black, cowboy brown, crown black, crown fire, crown gold, cupcake, deepsea bronze, deepsea orange, dutch, flower blue, flower pink, flower red, goggles seaweed, halo, halo fire, hat black, hat skull, hat visor blue, hat visor yellow, hat white, headband blue, headband red, helm army, helm biker, helm bronze, helm silver, horns, knight black, knight blue, knight red, mohawk green, mohawk purple, mohawk red, mullet blonde, mullet brown, ninja black, ninja blue, ninja red, nurse, piercings, pirate black, pirate red, prince, sunhat black, sunhat tan, sunhat white, sushi, top hat, tvhead grey, tvhead purple, tvhead white, unicorn horn, visor green, visor purple, wreath, wreath flowers
- shirt astro, astro black, astro orange, bandana green, bandana purple, bandana red, baseball blue, baseball red, buttondown black flannel, buttondown blue flannel, buttondown green, buttondown red flannel, buttondown tan, chain, combat black, combat green, costume dragon, costume frog, costume gorilla, costume hotdog, cowboy black, cowboy brown, deepsea bronze, deepsea orange, epaulette black, epaulette red, epaulette white, gown black, gown purple, gown white, hoodie black, hoodie purple, hoodie red, knight, knight black, knight leather, labcoat, lederhosen, monk, mononoke, ninja black, ninja blue, ninja red, nurse, overalls blue, overalls flannel, overalls pink, overalls red, overalls yellow, pirate black, pirate red, punk, robe blue, robe king, robe red, robe white, shirt bowtie, shirt white, shirt yellow, sweater black, sweater green chain, sweater orange, sweater pink, tanktop orange, tanktop pink, tanktop sailor black, tanktop sailor blue, tanktop sailor red, tanktop tattoo, tanktop white, tiger, toga, tshirt blue, tshirt green, tshirt metal, tshirt pink, tshirt red, tshirt white, tshirt yellow, viking brown, viking navy, wetsuit, winter blue, winter red, work blue, work red
- tier cool_1, cool_2, wild_1, wild_2, classy_1, classy_2, exotic_1, exotic_2