Skip to content

Instantly share code, notes, and snippets.

View johncovv's full-sized avatar
Coding...

John Covv johncovv

Coding...
View GitHub Profile

.

@johncovv
johncovv / LoadableReactIcon.tsx
Created November 21, 2022 01:44
Load react icon using tag name
import { IconBaseProps } from 'react-icons/lib';
import loadable from '@loadable/component';
interface IPropsIcon {
nameIcon: string;
propsIcon?: IconBaseProps;
}
export default function LoadableIcon({ nameIcon, propsIcon }: IPropsIcon): JSX.Element {
const lib = nameIcon
@johncovv
johncovv / wsl-proxy.ps1
Last active December 26, 2022 15:08
portproxy wsl2 to localhost
# check if you are in administration mode, if not, ask for authorization
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{
$arguments = "& '" + $myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
Break
}
# get wsl intern ip
$wsl_host = $(wsl hostname -I);
@johncovv
johncovv / CUSTOM_SERVICE_WORKER.md
Last active October 31, 2020 21:28
Creating a customized ServiceWorker for React and inserting push notification listener event

Custom ServiceWorker for React

These settings were made to integrate custom functions with the service worker.

Configuration to do before using the workbox

Go to the serviceWorker file in the project and make the following change.

    const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
    // to 
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"protocol": "inspector",
"restart": true,
"name": "Debug",
"skipFiles": ["<node_internals>/**"],