Skip to content

Instantly share code, notes, and snippets.

View dohoons's full-sized avatar

dohoons dohoons

View GitHub Profile
@dohoons
dohoons / ScrollPositionProvider.tsx
Last active July 30, 2020 04:52 — forked from schmidsi/ScrollPositionProvider.tsx
Scribble to fix scroll position
import React, { useEffect, useContext } from 'react';
import Router from 'next/router';
export const ScrollPositionContext = React.createContext({
triggerScroll: () => null,
});
export const useScrollPosition = () => useContext(ScrollPositionContext);
let routerBound = false;
@dohoons
dohoons / getBeautyWeight.js
Created June 24, 2020 13:50
getBeautyWeight
function getBeautyWeight(height, sex = 'men') {
const standardHeight = {
men: 175,
female: 163,
};
const standardRatio = {
men: 62.7 / standardHeight.men,
female: 49.2 / standardHeight.female,
};
const standardWeight = {
{
"tagname-lowercase": true,
"attr-lowercase": true,
"attr-value-double-quotes": true,
"attr-value-not-empty": false,
"attr-no-duplication": true,
"doctype-first": true,
"tag-pair": true,
"tag-self-close": false,
"spec-char-escape": false,
import React from 'react'
import { func, node, number, object, shape, string } from 'prop-types'
import { withRouter } from 'react-router-dom'
const debounce = (fn, time) => {
let timeout;
return function() {
const functionCall = () => fn.apply(this, arguments)
// scroll check
(function() {
var $window = $(window);
var $target = $('.scroll-check');
function scrollHandle() {
var winHeight = $window.height();
var scrollTop = $window.scrollTop();
$target.each(function() {
/* jQuery ui-datepicker extension */
/**
*
* https://gist.github.com/Artemeey/8bacd37964a8069a2eeee8c9b0bd2e44/
*
* Version: 1.0 (15.06.2016)
* Requires: jQuery v1.8+
* Requires: jQuery-UI v1.10+
*
@dohoons
dohoons / gulpfile.js
Last active May 11, 2018 01:34
multi depth img sprite
var gulp = require('gulp'),
path = require('path'),
merge = require('merge-stream'),
listFilepaths = require('list-filepaths'),
spritesmith = require('gulp.spritesmith-multi');
// 자동 스프라이트
gulp.task('auto-sprite', function() {
var stream = merge();
@dohoons
dohoons / .stylelintrc.json
Last active May 8, 2018 04:16
style lint
{
"rules": {
"color-no-invalid-hex": true,
"declaration-block-no-duplicate-properties": [
true,
{
"ignore": [
"consecutive-duplicates-with-different-values"
]
}
@dohoons
dohoons / memorySizeOfObject.js
Created April 4, 2018 13:27
calculate memory size of javascript object, it is not a accurate value!
function memorySizeOf(obj) {
var bytes = 0;
function sizeOf(obj) {
if(obj !== null && obj !== undefined) {
switch(typeof obj) {
case 'number':
bytes += 8;
break;
case 'string':
@dohoons
dohoons / getSafeArea.js
Last active April 20, 2020 03:33
getSafeArea()
function getSafeArea() {
var result, computed, div = document.createElement('div');
div.style.padding = 'env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)';
document.body.appendChild(div);
computed = getComputedStyle(div);
result = {
top: parseInt(computed.paddingTop) || 0,
right: parseInt(computed.paddingRight) || 0,
bottom: parseInt(computed.paddingBottom) || 0,