Skip to content

Instantly share code, notes, and snippets.

View lixiaoyan's full-sized avatar

XiaoYan Li lixiaoyan

  • Beijing, China
  • 09:32 (UTC +08:00)
View GitHub Profile
import { useState } from "react";
export const useStateWithDeps = <T>(
initialState: T | (() => T),
deps: unknown[],
) => {
const [state, setState] = useState(initialState);
const [currentDeps, setCurrentDeps] = useState(deps);
if (!shallowEqual(deps, currentDeps)) {
@lixiaoyan
lixiaoyan / Kara.vil
Last active November 28, 2023 05:07
{
"version": 1,
"uid": 6781217894371684000,
"layout": [
[
[
"KC_ESCAPE",
"KC_1",
"KC_2",
"KC_3",
{
"name": "wilba.tech WT60-H1",
"vendorProductId": 1703018532,
"macros": ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
"layers": [
[
"KC_ESC",
"KC_1",
"KC_2",
"KC_3",
;/*++
;
;Copyright (c) Cirrus Logic, Inc. All rights reserved.
;
; THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
; KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
; IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
; PURPOSE.
;
;Module Name:
@lixiaoyan
lixiaoyan / omega-bbs-cla-individual.txt
Created September 18, 2017 13:34
ω bbs Individual Contributor License Agreement
# ω bbs Individual Contributor License Agreement
Thank you for your interest in contributing to ω bbs ("We" or "Us").
This contributor agreement ("Agreement") documents the rights granted by contributors to Us. To make this document effective, please sign it and send it to Us, following the instructions at https://cla-assistant.io/. This is a legally binding document, so please read it carefully before agreeing to it. The Agreement may cover more than one software project managed by Us.
## 1. Definitions
**"You"** means the individual who Submits a Contribution to Us.
@lixiaoyan
lixiaoyan / entry.js
Last active June 28, 2019 20:33
React 16: ReactDOM.hydrate(...)
import React from "react";
import ReactDOM from "react-dom";
import { AppContainer } from "react-hot-loader";
import App from "./App";
const render = (hydrate = false) => {
const container = document.querySelector("#app");
const element = (
<AppContainer>
@lixiaoyan
lixiaoyan / Portal.js
Last active December 12, 2017 16:52
React 16: Portal
import React from "react";
import PropTypes from "prop-types";
import { createPortal } from "react-dom";
class Portal extends React.Component {
static propTypes = {
children: PropTypes.node,
};
state = { mounted: false };
@lixiaoyan
lixiaoyan / README.md
Last active June 21, 2021 08:46
Draft.js with line number.