Skip to content

Instantly share code, notes, and snippets.

View thewei's full-sized avatar
💭
I may be slow to respond.

Wilson thewei

💭
I may be slow to respond.
  • Guangzhou, Mainland China
View GitHub Profile
@thewei
thewei / TaskQe.js
Last active June 11, 2021 02:23
Javascript实现异步任务队列类
/*
@Author:thewei
@website:http://www.99is.com
@title: 异步事件任务队列类
*/
(function(){
TaskQe = function(){
this._arrayFn = []; //事件集合
@thewei
thewei / dir2tree.js
Last active August 29, 2015 14:21 — forked from dongyuwei/dir2tree.js
(function() {
var path = require('path'), fs = require('fs');
function walk(uri,filter,tree) {
var node = {
name : null,
children : [],
pNode : null,
};
// ==UserScript==
// @name v2ex better
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://www.v2ex.com/*
// @grant none
// ==/UserScript==
/* jshint -W097 */
@thewei
thewei / Enhance.js
Created May 16, 2016 01:48 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@thewei
thewei / Photoshop-LayersToPNG.jsx
Created August 8, 2017 10:05 — forked from NathanSweet/Photoshop-LayersToPNG.jsx
Adobe Photoshop script to export to Esoteric Software's Spine: http://esotericsoftware.com/
// This script exports photoshop layers as individual PNGs. It also
// writes a JSON file that can be imported into Spine where the images
// will be displayed in the same positions and draw order.
// Setting defaults.
var writePngs = true;
var writeTemplate = false;
var writeJson = true;
var ignoreHiddenLayers = true;
var pngScale = 1;
""""""""""""""""""""""
" Leader
""""""""""""""""""""""
" let mapleader=,
" can't set leaders in Obsidian vim, so the key just has to be used consistently.
" However, it needs to be unmapped, to not trigger default behavior: https://github.com/esm7/obsidian-vimrc-support#some-help-with-binding-space-chords-doom-and-spacemacs-fans
unmap ,
" map ; to : in normal mode, so that I don’t rely on the shift key
" nmap ; :