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;
/* 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 / 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':