Skip to content

Instantly share code, notes, and snippets.

View MrKou47's full-sized avatar

Kbscript MrKou47

View GitHub Profile
@MrKou47
MrKou47 / index.html
Created March 28, 2024 08:45 — forked from billimarie/index.html
threejs canvasrenderer gradient background css
<script src="http://www.threejs.org/build/three.min.js"></script>
<script src="http://www.threejs.org/examples/js/renderers/Projector.js"></script>
<script src="http://www.threejs.org/examples/js/renderers/CanvasRenderer.js"></script>
<script>
var mouseX = 0, mouseY = 0,
windowHalfX = window.innerWidth / 2,
windowHalfY = window.innerHeight / 2,
@MrKou47
MrKou47 / observe.js
Created March 7, 2024 02:06
Observe Object changes in Javascript
function observe(object, onChange) {
function buildProxy(prefix, object) {
return new Proxy(object, {
set(target, property, value) {
// calling original set property value
target[property] = value;
// log the change
// @ts-ignore
console.log(`Property ${prefix}${property} has changed to: `, value);
@MrKou47
MrKou47 / clamp.js
Created July 10, 2023 07:43
Math.Clamp() in Javascript
function clamp(value, min, max) {
return Math.min(Math.max(value, min), max);
}
@MrKou47
MrKou47 / machine.js
Last active June 15, 2021 09:23
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@MrKou47
MrKou47 / .gitignore
Created February 3, 2021 09:21 — forked from qzm/.gitignore
.yarnrc fo Chinese developer
node_modules/
{
"Profiles": [
{
"Ansi 6 Color" : {
"Red Component" : 0.33725491166114807,
"Color Space" : "Calibrated",
"Blue Component" : 0.7607843279838562,
"Alpha Component" : 1,
"Green Component" : 0.7137255072593689
},
@MrKou47
MrKou47 / brewlist
Created July 29, 2020 05:36
my brew list
autoconf
autojump
automake
bat
elixir
erlang
gdbm
grpcurl
ios-webkit-debug-proxy
jpeg
import * as React from "react";
import { PropertyControls, ControlType, Override } from "framer";
import { data } from "./Examples";
const style: React.CSSProperties = {
height: "100%",
display: "flex",
alignItems: "center",
justifyContent: "center",
textAlign: "center",
color: "#8855FF",
@MrKou47
MrKou47 / store.ts
Created May 7, 2020 05:24
awesome composite by typescript and redux
import { createStore, combineReducers, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import { request } from './utils/utils';
import accountlist from './containers/AccountList/reducer';
import withdraworder from './containers/WithdrawOrder/reducer';
const userInitialState = {
}
@MrKou47
MrKou47 / extract-returntype-from-async-function.ts
Last active February 15, 2019 08:08
typescript type operate
const x = async (y) => {
return 1
}
type Unpacked<T> =
T extends Promise<infer U> ? U :
T;
export type T = Unpacked<ReturnType<typeof x>> // number