Skip to content

Instantly share code, notes, and snippets.

View sorie's full-sized avatar
💭
I may be slow to respond.

lala sorie

💭
I may be slow to respond.
  • Seoul or Jeju island
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,600" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/tachyons/4.9.0/tachyons.css" rel="stylesheet">
<title>JS Bin</title>
<style id="jsbin-css">
@sorie
sorie / WatchTest01.html
Created March 29, 2019 01:47
vue.js에서의 watch속성을 이용하여 watch의 장점인 긴시간 비동기 처리의 예인 외부서버와의 통신 기능을 다음과 같이 해보았다.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div id="list">
@sorie
sorie / what-forces-layout.md
Created January 18, 2021 08:59 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@sorie
sorie / dom_performance_reflow_repaint.md
Created January 29, 2021 07:35 — forked from faressoft/dom_performance_reflow_repaint.md
DOM Performance (Reflow & Repaint) (Summary)

DOM Performance

Rendering

  • How the browser renders the document
    • Receives the data (bytes) from the server.
    • Parses and converts into tokens (<, TagName, Attribute, AttributeValue, >).
    • Turns tokens into nodes.
    • Turns nodes into the DOM tree.
  • Builds CSSOM tree from the css rules.
@sorie
sorie / gist:fff0078770a222728debe66ac8c3e669
Created June 25, 2021 01:32 — forked from chad3814/gist:2924672
deleting array items in javascript with forEach() and splice()
// This is from my comment here: http://wolfram.kriesing.de/blog/index.php/2008/javascript-remove-element-from-array/comment-page-2#comment-466561
/*
* How to delete items from an Array in JavaScript, an exhaustive guide
*/
// DON'T use the delete operator, it leaves a hole in the array:
var arr = [4, 5, 6];
delete arr[1]; // arr now: [4, undefined, 6]
@sorie
sorie / gist:25ae00ead81411d8fd50d933851e29b5
Last active July 1, 2021 08:38
Check await order when trying/catch
(async () => {
try{
await (() => {
console.log( 'try await');
throw error;
console.log('after throw error');
})();
// throw error;
// await (() =>{console.info('after throw error')})();
return '사과';
@sorie
sorie / gist:94ff1fe03f9914993be48252576eb795
Last active July 1, 2021 08:49
async/await 와 Promise#then
async function getApple() {
await delay(1000);
return '사과';
}
async function getBanana() {
await delay(1000);
return '바나나';
}
@sorie
sorie / gist:9aa645f5ec1202c794f7b2588240347e
Created July 1, 2021 08:50
async vs differ & usestrict사용이유
head안에 async를 넣으면 html parcing과 병렬로 실행된다.
head안에 differ를 넣으면 html parcing을 끝내고 실행된다.
usestrict 사용
typescript를 사용할때는 필요없지만
javascript는 많이 유연한 언어로 ecmascript5를 사용하겠다는 이야기
예를 들어 선언되지도 않은 변수를 불러와도 문제가 없었지만 usestrict를 사용하면 에러가 발생한다.더욱 엄격해지는것.
/**
1. 프로미스를 반환할 수도 있다.
2. then후에 반아오는 변수가 하나일 경우는 생략할 수 있다.
**/
const getHen = () =>
new Promise((resolve, reject) => {
setTimeout(() => resolve('닭'), 1000);
});
@sorie
sorie / gist:928111dec1107e698466142667c15680
Created July 1, 2021 08:52
json에 대한 모르던 사실
/**
json 모르던 사실
1. json안에서 함수사용가능하지만 stringify후 object로 바꾸면 함수는 사라진다.
2. stringify사용시 특정 값만 나오게 할수 있다.
3. stringify사용시 콜백함수를 사용할 수 있다.
**/
json = JSON.stringify(rabbit);
json = JSON.stringify(rabbit, ['name','color','size']);
json = JSON.stringify(rabbit, (key, value) => {