Skip to content

Instantly share code, notes, and snippets.

View pocojang's full-sized avatar
🐢

Poco pocojang

🐢
View GitHub Profile
@pocojang
pocojang / dom_performance_reflow_repaint.md
Created April 28, 2022 12:43 — 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.
@pocojang
pocojang / .eslintignore
Created October 27, 2020 06:31 — forked from RyanHirsch/.eslintignore
Typescript + Jest + ESLint + Tailwind
.next
__generated__
@pocojang
pocojang / React-Hooks.js
Created June 5, 2020 07:20 — forked from craigtaub/React-Hooks.js
Nested React Hooks
// Engine
const React = {
index: 0,
state: [],
useEffect: (callback, dependencies) => {
const cachedIndex = React.index;
const hasChanged = dependencies !== React.state[cachedIndex];
if (dependencies === undefined || hasChanged) {
callback();
@pocojang
pocojang / README-Template.md
Created February 16, 2020 07:15 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@pocojang
pocojang / useDetectScrollEnd.js
Created June 28, 2019 01:54 — forked from almond-bongbong/useDetectScrollEnd.js
custom hook for detecting scroll end
import { useState, useRef, useEffect, useCallback } from 'react';
import throttle from 'lodash/throttle';
const useDetectScrollEnd = (endPercent = 0.9) => {
const scrollEnded = useRef(false);
const [isScrollEnd, setIsScrollEnd] = useState(false);
const handleScroll = useCallback(throttle(() => {
const { scrollY, innerHeight } = window;
const scrollPercent = (scrollY + innerHeight) / document.body.scrollHeight;
@pocojang
pocojang / s70_1_0.js
Created June 20, 2018 21:10 — forked from woowawebui/s70_1_0.js
구구단
for (var i = 1; i <= 9; i++) {
for (var j = 1; j <= 9; j++) {
console.log(i, 'X', j, '=', i * j);
}
}
eachDan(7);
for (var i = 8; i <= 18; i += 2) eachDan(i);
printDan([3, 7, 9, 13]);
var Html = function(){};
Html.prototype = new Renderer();
Html.prototype._init = function(){
if(typeof this.completeLi !== 'undefined' && typeof this.progressLi !== 'undefined') {
return;
}
this.progressLi = document.querySelector('#todo .progress li');
this.completeLi = document.querySelector('#todo .complete li');
var todo = (function(){
var tasks = [];
var addTask = (function(){
var id = 0;
return function(title){
var result = id;
tasks.push({id: id++, title: title, state: STATE.PROGRESS()});
render();
return result;