Skip to content

Instantly share code, notes, and snippets.

@undoZen
undoZen / README.md
Last active April 24, 2024 00:25
Remesh snippets for VSCode

Remesh snippets for VS Code.

Installation

VSCode

per workspace

  1. cd into you the .vscode directory in your project, mkdir .vscode if this folder does not exists.
  2. wget https://gist.githubusercontent.com/undoZen/d104b2c88086f90165c438b61ef7c99b/raw/typescript.code-snippets
import React, { memo, Suspense } from 'react';
import { of, from, pipe } from 'rxjs';
import { map, switchMap, pluck } from 'rxjs/operators';
import { createRxContainer, LOADING } from '@/utils/unstated-rxjs';
import { tapLog } from '@/utils/operators';
const delay = (value: any, waitMs: number) =>
new Promise(resolve => {
setTimeout(() => resolve(value), waitMs);
});
@undoZen
undoZen / suspensify.js
Last active April 18, 2020 15:48
use-rx-init-demo
import React, { memo, Suspense, useMemo } from 'react';
import { useRxInit, suspensify } from '@/utils';
import { of, from, Observable } from 'rxjs';
let r = (n, ms) =>
new Promise(resolve => {
setTimeout(() => resolve(n), ms);
});
let Loading = () => <span>loading...</span>;
let SayHello = memo(({ ctx }) => {
@undoZen
undoZen / production.js
Created March 27, 2019 05:49
Taro webpack h5 build hash all assets
module.exports = {
h5: {
miniCssExtractPluginOption: {
filename: 'css/[name].[hash].css',
chunkFilename: 'css/[id].[chunkhash].css'
},
enableDll: false,
webpackChain(chain, webpack) {
const hashRule = (type) => {
chain.module.rules.get(type).uses.get("urlLoader").get("options").name =
@undoZen
undoZen / store.js
Created October 20, 2016 08:22
an failed experiment with freezer-js
'use strict'
import Freezer from 'freezer-js'
import {assign, isArray, each, toPath} from 'lodash'
import h from 'react-hyperscript'
import {Component, PureComponent} from 'react'
var store = new Freezer({})
export default store
console.log(store);
@undoZen
undoZen / Esc2CtrlEsc.ahk
Created September 20, 2016 02:52
just map your capslock to esc and apply this script, then you can press capslock to send esc, or hold it to act as ctrl
g_LastCtrlKeyDownTime := 0
g_AbortSendEsc := false
g_ControlRepeatDetected := false
*Esc::
if (g_ControlRepeatDetected)
{
return
}
@undoZen
undoZen / extensions.json
Created August 24, 2016 04:00
Visual Studio code settings
[
{
"metadata": {
"id": "e337c67b-55c2-4fef-8949-eb260e7fb7fd",
"publisherId": "ac3a3342-db76-40ef-9277-4657632d3bfe",
"publisherDisplayName": "Shan Khan"
},
"name": "code-settings-sync",
"publisher": "Shan",
"version": "1.6.3"
@undoZen
undoZen / jspm-react-hot-reloader-demo.sh
Last active April 13, 2016 06:18
jspm-react-hot-reloader-demo
#!/usr/bin/env bash
git clone https://github.com/guybedford/jspm-react-component-demo.git
cd jspm-react-component-demo
npm i --save-dev jspm@beta chokidar-socket-emitter ecstatic
./node_modules/.bin/jspm i
./node_modules/.bin/jspm i --dev systemjs-hot-reloader #update to fix a bug
echo 'installation done, have fun!'
echo 'first `cd jspm-react-component-demo` into demo directory, then'
#!/usr/bin/env bash
curl https://raw.githubusercontent.com/creationix/nvm/v0.22.2/install.sh | bash
cd .nvm
git remote add ljharb https://github.com/ljharb/nvm.git
git fetch ljharb
git checkout ljharb/iojs
#!/usr/bin/env bash
export N_PREFIX=$HOME/.ivm
export N_BIN=$N_PREFIX/bin
test -d $N_BIN || mkdir -p $N_BIN
pushd $N_BIN
wget https://raw.githubusercontent.com/demohi/ivm/ce260674aeb8a446a3790784461156085f634c5b/bin/ivm
chmod a+x ivm
popd
echo 'export N_PREFIX=$HOME/.ivm' >> .bashrc