Skip to content

Instantly share code, notes, and snippets.

🐷
is watching you.

TZ | 天猪 atian25

🐷
is watching you.
Block or report user

Report or block atian25

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
View lazy_require.js
function lazyRequire(id) {
return new Proxy({}, {
get: (_, key, reciver) => {
const mod = require(id);
return Reflect.get(mod, key, reciver);
},
});
}
const fs = lazyRequire('fs');
View debugadapter.txt
OS: darwin x64
Adapter node: v7.9.0 x64
vscode-chrome-debug-core: 5.0.2
16:27:32, 2018-6-13
node-debug2: 1.24.2
From client: initialize({"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"node2","locale":"en","linesStartAt1":true,"columnsStartAt1":true,"pathFormat":"path","supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true})
To client: {"seq":0,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"exceptionBreakpointFilters":[{"label":"All Exceptions","filter":"all","default":false},{"label":"Uncaught Exceptions","filter":"uncaught","default":false}],"supportsConfigurationDoneRequest":true,"supportsSetVariable":true,"supportsConditionalBreakpoints":true,"supportsCompletionsRequest":true,"supportsHitConditionalBreakpoints":true,"supportsRestartFrame":true,"supportsExceptionInfoRequest":true,"supportsDelayedStackTraceLoading":true,"supportsValueFormattingOptions":true,"supportsEvaluateForHovers":true,"supportsLogPoints":true}}
@atian25
atian25 / result.md
Last active Nov 22, 2017
error stack - co vs async
View result.md

Intro

compare error stack between egg@1(co-base) and egg@2(async-base)

Fixture

// /app/service/test.js
class TestService extends Service {
  echo() {
@atian25
atian25 / log
Last active Oct 10, 2017
now.sh issue report
View log
➜ showcase git:(now) ✗ now log https://showcase-vonarcxljh.now.sh/
10/10 12:55 PM npm install
10/10 12:55 PM ⧗ Installing 11 main dependencies…
10/10 12:56 PM ✓ Installed 896 modules [13s]
10/10 12:56 PM npm start
10/10 12:56 PM npm WARN lifecycle The node binary used for scripts is /home/nowuser/bin/node but npm is using /usr/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
10/10 12:56 PM
> showcase@1.0.0 start /home/nowuser/src
> egg-scripts start --workers=1
10/10 12:56 PM
@atian25
atian25 / egg-scripts-proposals-465.md
Created Feb 28, 2017
egg-scripts proposals #465 backup
View egg-scripts-proposals-465.md

https://github.com/eggjs/egg/issues/241 太长了,重开一个,讨论第一期的实现方案。

仅提供 egg-scripts startegg-scripts stop 几条最基础的线上指令。 而看了下原内网的实现,会比较依赖于环境变量,本方案更倾向于用 cli options 的方式

start

$ egg-scripts start --baseDir=<APP_BASE> --port=7001 --env=prod --workers=2 --no-daemon
@atian25
atian25 / header_get.js
Created Sep 20, 2016
get header use lowercase, 10x speed
View header_get.js
'use strict';
const Benchmark = require('benchmark');
const benchmarks = require('beautify-benchmark');
const suite = new Benchmark.Suite();
suite
.add('get header all lower case', function() {
const res = {};
res['x-frame-options1'] = 'X-Frame-Options1 value';
@atian25
atian25 / gist:9670423a725a35d844fe4d9e5189800a
Created Aug 31, 2016 — forked from jimbojsb/gist:1630790
Code highlighting for Keynote presentations
View gist:9670423a725a35d844fe4d9e5189800a

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@atian25
atian25 / z-automator.png
Created Aug 31, 2016 — forked from lrytz/z-automator.png
Shortcut for Syntax Highlighting in Keynote
View z-automator.png
@atian25
atian25 / set-header.js
Created Aug 31, 2016 — forked from fengmk2/set-header.js
set header benchmark
View set-header.js
'use strict';
const OutgoingMessage = require('http').OutgoingMessage;
'use strict';
const Benchmark = require('benchmark');
const benchmarks = require('beautify-benchmark');
const suite = new Benchmark.Suite();
You can’t perform that action at this time.