Skip to content

Instantly share code, notes, and snippets.

遊真·uZen undoZen

Block or report user

Report or block undoZen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@undoZen
undoZen / production.js
Created Mar 27, 2019
Taro webpack h5 build hash all assets
View production.js
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 Oct 20, 2016
an failed experiment with freezer-js
View store.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 Sep 20, 2016
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
View Esc2CtrlEsc.ahk
g_LastCtrlKeyDownTime := 0
g_AbortSendEsc := false
g_ControlRepeatDetected := false
*Esc::
if (g_ControlRepeatDetected)
{
return
}
@undoZen
undoZen / extensions.json
Created Aug 24, 2016
Visual Studio code settings
View extensions.json
[
{
"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 Apr 13, 2016
jspm-react-hot-reloader-demo
View jspm-react-hot-reloader-demo.sh
#!/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'
View install-nvm-with-iojs.sh
#!/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
View install-ivm.sh
#!/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
View gulpfile.js
function isMasterRunning() {
var pidFilePath = path.join(__dirname, 'ds.pid');
var strpid;
var isRunning;
if (fs.existsSync(pidFilePath)) {
strpid = fs.readFileSync(pidFilePath, 'utf-8');
isRunning = require('is-running')(parseInt(strpid, 10));
}
if (isRunning) {
return strpid;
View rewriteRouteProto.js
var routeProto = require('express/lib/router/route').prototype;
var routerProto = require('express/lib/router');
var methods = require('express/node_modules/methods').concat(['all']);
wrapCallback = function (c) {
return c;
}
methods.forEach(function (method) {
var orig = routeProto[method];
routeProto[method] = function () {
var callbacks = utils.flatten([].slice.call(arguments));
View index.js
'use strict';
var http = require('http');
var request = require('request');
var nth = require('co-nth-arg');
var _ = require('lodash');
module.exports = function (propName, options) {
propName = propName || 'api';
You can’t perform that action at this time.