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
// Finds the inner most | |
export const getInnerError = (e) => { | |
const _getInner = (_e) => { | |
if (!_e) return undefined; | |
if (typeof _e == 'string') return _e; | |
return _getInner(_e.error) || _getInner(_e.data) || _getInner(_e.response) || _getInner(_e.message); | |
}; | |
return _getInner(e) || 'Unknown error.'; |
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
{ | |
// Place your snippets for cpp here. Each snippet is defined under a snippet name and has a prefix, body and | |
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | |
// same ids are connected. | |
// Example: | |
"Generate class header": { | |
"prefix": "cls", | |
"body": [ | |
"#pragma once", |
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
{ | |
"window.title": "${dirty} ${folderPath} 💠 ${activeEditorMedium} 🔷 ${rootName} ", | |
"explorer.autoReveal": true, | |
"explorer.autoCollapse": false, | |
"explorer.confirmDelete": false, | |
"explorer.confirmDragAndDrop": false, | |
"explorer.compactFolders": true, | |
"workbench.layoutControl.enabled": true, | |
"workbench.list.smoothScrolling": true, | |
//"workbench.list.mouseWheelScrollSensitivity": ".2", // mac |
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
/** | |
* @author [email protected] (Daniel Kennedy) | |
* @copyright Copyright (c) 2021, AdCloud | |
* @description GoogleAnalyticsService | |
*/ | |
// https://support.google.com/analytics/answer/9213390?hl=en&utm_id=ad#zippy=%2Cin-this-article | |
// https://www.npmjs.com/package/ga-4-react | |
// ga4.gtag('event','pageview','path') |
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 none = {}; | |
export function useJitRef(init) { | |
const value = useRef(none); | |
const ref = useLazyRef(() => ({ | |
get current() { | |
if (value.current === none) { | |
value.current = init(); | |
} | |
return value.current; | |
}, |
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
import { useEffect, useRef, useState } from 'react'; | |
export function useScrollDirection(element = window) { | |
const prevScrollY = useRef(0) | |
const [goingUp, setGoingUp] = useState(false); | |
const handleScroll = () => { | |
const currentScrollY = element.scrollTop; | |
if (prevScrollY.current < currentScrollY && goingUp) { | |
setGoingUp(false); |
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
/* Usage: | |
import { getLogger } from 'lib/utils/logging'; | |
const { log, warn } = getLogger('somename'); | |
log('something', ...); // will log/show if enabled | |
warn('something', ...); // will always log/show | |
*/ | |
export const DEFAULT_LOG_COLOR = 'yellow'; | |
export const Colors = { | |
reset: "\x1b[0m", |
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
"dev": "nodemon --signal SIGTERM --watch './src/**/*' -e ts,js,json,env --exec \"npm run restart\"", | |
restart.sh: | |
node build/index.js --no-deprecation --no-warnings --trace-deprecation |
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
import React, { useEffect, useState } from 'react'; | |
import { isMobile } from 'lib/utils/UiUtils'; | |
// Dynamic component which rendered a different child depending on mobile vs. desktop. | |
// Will re-render upon resize state change. | |
export default MobileComponent = ({ component: Component, ...props }) => { | |
const [currIsMobile, setIsMobile] = useState(isMobile()); | |
useEffect(() => { | |
window.addEventListener('resize', (e) => { |
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
{ | |
"name": "", | |
"version": "1.0.0", | |
"description": "", | |
"main": "build/index.js", | |
"scripts": { | |
"setup": "npm install", | |
"serve": "node build/index.js", | |
"dev": "concurrently --kill-others \"npm run build-watcher\" \"npm run build-reload\"", | |
"build-watcher": "nodemon --watch './src/**/*' -e ts,tsx,js,jsx,scss,html,json,env --exec \"npm run build\"", |