Skip to content

Instantly share code, notes, and snippets.

View Wxh16144's full-sized avatar
♥️
antd & React

Wxh16144

♥️
antd & React
View GitHub Profile
@mjackson
mjackson / color-conversion-algorithms.js
Last active July 24, 2024 13:28
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@Keith-Morris
Keith-Morris / index.html
Last active January 24, 2024 07:08
three.js css3d - periodic table. info.
<div id="container"></div>
<div id="menu">
<button id="table">TABLE</button>
<button id="sphere">SPHERE</button>
<button id="helix">HELIX</button>
<button id="grid">GRID</button>
</div>
@zulhfreelancer
zulhfreelancer / exclude_regex.md
Last active August 21, 2023 10:12
Chrome console: How to filter exclude certain logs?

Use this:

^((?![INSERT YOUR WORD THAT YOU WANT TO EXCLUDE HERE]).)*$

Don't forget to check the Regex checkbox!

Example:

I'm excluding logs that contains Pusher words here. So, this is what I put inside the filter box: ^((?!pusher).)*$

@gaearon
gaearon / connect.js
Last active June 24, 2024 09:43
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
@2KAbhishek
2KAbhishek / Shell_Keybindings.md
Last active July 20, 2024 06:11
Keyboard shortcuts for bash/zsh

Shell Keybindings

Navigation 🚀

Keybinding Action
Alt + f/b Move cursor to previous/next word
Ctrl + a/e Move cursor to beginning/end of command
Ctrl + xx Toggle between the start of line and current cursor position
@PradyumnaKrishna
PradyumnaKrishna / Commit Date.md
Last active July 15, 2024 20:05
Change Git Commit Date

Change Git Commit Date

  • Commit your git using

    git add -A
    git commit -m "commit message"
    
  • Change time or date of your latest commit

GIT_COMMITTER_DATE="Wed Sep 9 22:00 2020 +0530" git commit --amend --date="Wed Sep 9 22:00 2020 +0530"

@sindresorhus
sindresorhus / esm-package.md
Last active July 27, 2024 02:58
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.
@Wxh16144
Wxh16144 / .gitconfig
Last active January 3, 2023 07:54
oh-my-zsh
[user]
name = wuxh
email = wxh1220@gmail.com
signingkey = wuxh
[core]
excludesfile = /Users/wuxh/.gitignore_global
ignorecase = true
# ref: https://stackoverflow.com/a/36427485/11302760
# ref: https://code.visualstudio.com/docs/editor/versioncontrol#_vs-code-as-git-editor
editor = code --disable-extensions --wait
"use client";
import { cache, unstable_postpone } from "react";
import { preload } from "react-dom";
const loadImage = cache((src: string) => {
return new Promise<void>((resolve, reject) => {
const img = new Image();
img.src = src;