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 / 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
@wwsun
wwsun / render-props.md
Created May 31, 2023 09:44 — forked from heygrady/render-props.md
Avoiding HOC; Favoring render props
@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 / 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 / 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 / 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 / EventUtil.js
Created May 13, 2015 02:15
Event handler in multiple browsers
var EventUtil = {
addHandler: function (element, type, handler) {
if (element.addEventListener) { // DOM2
element.addEventListener(type, handler, false); // false means handle the events when bubbling
} else if (element.attachEvent) { // IE
element.attachEvent("on" + type, handler);
} else { // DOM0
element["on" + type] = handler;
@wwsun
wwsun / cookieUtil.js
Created May 12, 2015 01:29
cookie utility object to get/set/unset the cookie pair
var CookieUtil = {
get: function (name) {
var cookieName = encodeURIComponent(name) + "=",
cookieStart = document.cookie.indexOf(cookieName),
cookieValue = null;
if (cookieStart > -1) {
var cookieEnd = document.cookie.indexOf(";", cookieStart);
if (cookieEnd == -1) {
@wwsun
wwsun / example.js
Created May 11, 2015 12:49
AMD Demo
define([], function() {
return 'Example file';
});
@wwsun
wwsun / MyArrayList.java
Created May 7, 2015 08:32
A basic ArrayList implementation(Java)
package me.wwsun.list;
import java.util.Iterator;
/**
*
* @param <E> is the type of elements in this list
*/
public class MyArrayList<E> implements Iterable<E> {