Skip to content

Instantly share code, notes, and snippets.

View danielpza's full-sized avatar
👀

Daniel Perez Alvarez danielpza

👀
View GitHub Profile
import { ComponentType, Suspense } from 'react';
export function withSuspense<T extends {}>(
Component: ComponentType<T>,
Fallback: ComponentType<Partial<T>>
) {
const displayName = Component.displayName || Component.name || 'Component';
function ComponentWithSuspense(props: T) {
return (
@danielpza
danielpza / path-mapping.md
Last active December 2, 2022 21:35
Path Mapping Javascript

What is path mapping/path aliases

eg change import {} from '@/some-alias' to import {} from '../../some-alias'

How to do path mapping in javascript

For editor support see https://www.typescriptlang.org/tsconfig#paths

NodeJs Module

@belgattitude
belgattitude / ci-yarn-install.md
Last active November 5, 2024 08:32
Composite github action to improve CI time with yarn 3+ / node-modules linker.
@raysan5
raysan5 / raylib_vs_sdl.md
Last active November 14, 2024 18:25
raylib vs SDL - A libraries comparison

raylib_vs_sdl

In the last years I've been asked multiple times about the comparison between raylib and SDL libraries. Unfortunately, my experience with SDL was quite limited so I couldn't provide a good comparison. In the last two years I've learned about SDL and used it to teach at University so I feel that now I can provide a good comparison between both.

Hope it helps future users to better understand this two libraries internals and functionality.

Table of Content

diff --git a/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js b/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js
index 441442f..a536c7a 100644
--- a/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js
+++ b/node_modules/eslint-plugin-react-hooks/cjs/eslint-plugin-react-hooks.development.js
@@ -735,7 +735,29 @@ var ExhaustiveDeps = {
},
enableDangerousAutofixThisMayCauseInfiniteLoops: {
type: 'boolean'
- }
+ },
@arniebradfo
arniebradfo / app.tsx
Last active January 29, 2024 14:33
React Disable Imported Styles
import React from 'react'
LazyCssComponent = React.lazy(() => import('./cssComponent'))
AnotherLazyCssComponent = React.lazy(() => import('./anotherCssComponent'))
export const App: React.FC = () =>(
<React.Suspense fallback={<></>}>
{condition && <LazyCssComponent/>}
{!condition && <AnotherLazyCssComponent/>}
</React.Suspense>
@sindresorhus
sindresorhus / esm-package.md
Last active November 17, 2024 22:07
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@rangeoshun
rangeoshun / config.el
Last active June 12, 2023 15:45
Typescript with CSS in JS (styled-components, Emotion), JSX and graphql highlight and major mode for Emacs Doom with `mmm-mode` for *.tsx
;; Assign typescript-mode to .tsx files
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode))
(require 'mmm-mode)
(setq mmm-global-mode t)
(setq mmm-submode-decoration-level 0) ;; Turn off background highlight
;; Add css mode for CSS in JS blocks
(mmm-add-classes
'((mmm-styled-mode
@John-Paul-R
John-Paul-R / FabricModList.md
Last active October 21, 2024 07:40
A list of (almost all) mods for Fabric

Fabric Mod List

This page contains a list of the current Minecraft Fabric mods. (As of 2021-08-19 08:05:23 Timezone: UTC+0000 (GMT))

To search for mods by name, category, or download count, visit the website, fibermc.com!

Note: You can view a mod's source files by following the "Source" link on its CurseForge page, assuming that the mod's creator has made such files public.

There are currently 2954 mods in this list.

@umidjons
umidjons / youtube-dl-download-audio-only-on-best-quality.md
Last active November 14, 2024 21:20
Download Audio from YouTube with youtube-dl

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track