This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
React.useEffect(() => { | |
const section = pageRef.current | |
let currentPixel = window.pageYOffset | |
const looper = () => { | |
const newPixel = window.pageYOffset | |
const diff = newPixel - currentPixel | |
const speed = diff * 0.01 | |
if (section) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const units = ['bytes', 'kb', 'mb', 'gb', 'tb', 'pb', 'eb', 'zb', 'yb']; | |
export const getSizeFromBytes = x => { | |
let l = 0, | |
n = parseInt(x, 10) || 0; | |
while (n >= 1024 && ++l) n = n / 1024; | |
// include a decimal point and a tenths-place digit if presenting | |
// less than ten of KB or greater units | |
return n.toFixed(n < 10 && l > 0 ? 1 : 0) + ' ' + units[l]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default async (method, url, payload) => { | |
try { | |
const config = { | |
...(method !== 'GET' && { body: JSON.stringify(payload) }), | |
method: method, | |
headers: { | |
'Content-Type': 'application/json', | |
...(token && { Bearer: `token` }) | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } | |
Plugin 'pangloss/vim-javascript', { 'for': ['javascript', 'javascript.jsx'] } | |
Plugin 'mxw/vim-jsx', { 'for': ['javascript', 'javascript.jsx'] } |