Skip to content

Instantly share code, notes, and snippets.

View wwsun's full-sized avatar
🤡
Happy Coding

Wells wwsun

🤡
Happy Coding
View GitHub Profile
@wwsun
wwsun / util.js
Created May 21, 2015 06:25
Methods to check Array, Function, or RegExp
function isArray(value){
return Object.prototype.toString().call(value) == '[Object Array]';
}
function isFunction(value) {
return Object.prototype.toString().call(value) == '[Object Function]';
}
function isRegExp(value) {
return Object.prototype.toString().call(value) == '[Object RegExp]';
@wwsun
wwsun / browserify-pack-prelude.js
Created June 30, 2015 08:31
a simple require methods implemented in browserify
// modules are defined as an array
// [ module function, map of requireuires ]
//
// map of requireuires is short require name -> numeric require
//
// anything defined in a previous bundle is accessed via the
// orig method which is the requireuire for previous bundles
(function outer (modules, cache, entry) {
// Save the require from previous bundle to this closure if any
@wwsun
wwsun / index.html
Last active May 11, 2016 12:49
css: nav-arrow
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
@wwsun
wwsun / foo.tsx
Created July 19, 2022 08:25 — forked from OliverJAsh/foo.tsx
TypeScript React HOC using `forwardRef`
import * as React from 'react';
import { Component, ComponentClass, createRef, forwardRef, Ref } from 'react';
const myHoc = <ComposedComponentProps extends {}>(
ComposedComponent: ComponentClass<ComposedComponentProps>,
) => {
type ComposedComponentInstance = InstanceType<typeof ComposedComponent>;
type WrapperComponentProps = ComposedComponentProps & {
wrapperComponentProp: number;
@wwsun
wwsun / render-props.md
Created May 31, 2023 09:44 — forked from heygrady/render-props.md
Avoiding HOC; Favoring render props
@wwsun
wwsun / table.md
Created September 15, 2023 03:05
tango-advantanges
Comparison Items Schema-base low-code solution Tango (Code-based)
Applicable Scenarios Targeted vertical building scenarios, such as forms, marketing pages, etc. 🔥 Applicable to application building scenarios centered on source code
Language Capabilities Relies on private protocols for extension, inflexible, and difficult to align with programming language capabilities 🔥 Based directly on JavaScript language, can use all language features, no extensibility issues
Development Capability LowC