Skip to content
gqlxj1987's Blog
Go back

今日阅读列表

Edit page

gor

Gor is a simple http traffic replication tool written in Go. Its main goal is to replay traffic from production servers to staging and dev environments.

项目地址

主要的使用命令:

sudo gor --input-raw :80 --output-http "http://staging.com"

这部分的功能好像有延迟的问题,需要考虑

# write to file
gor --input-raw :80 --output-file requests.gor

# read from file
gor --input-file requests.gor --output-http "http://staging.com"
# Replay server (replay.local).
gor --input-tcp replay.local:28020 --output-http http://staging.com

# Run on servers where you want to catch traffic. You can run it on each `web` machine.
sudo gor --input-raw :80 --output-tcp replay.local:28020

当然,这块还有更多的扩展

jquery.each

We can break the $.each() loop at a particular iteration by making the callback function return false. Returning non-false is the same as a continue statement in a for loop; it will skip immediately to the next iteration.

(function(){
    // 結束循環(即break)
    jQuery.each(aOptionList, function(index, option){
        if (option.innerHTML === "stop") {
            return false;  // 返回false即break掉each循環
        }
        // magic
    });

    // 繼續下一個循環(即continue)
    jQuery.each(aOptionList, function(index, option){
        if (option.innerHTML === "stop") {
            return true;  // 返回任意非false值
        }
        // magic
    });
}());

ajax过程

  1. 创建XMLHttpRequest对象,也就是创建一个异步调用对象.
  1. 创建一个新的HTTP请求,并指定该HTTP请求的方法、URL及验证信息.
  1. 设置响应HTTP请求状态变化的函数.
  1. 发送HTTP请求.
  1. 获取异步调用返回的数据.
  1. 使用JavaScript和DOM实现局部刷新.

浏览器并发

6个并发

js闭包

好处部分:

<script>
function outer(){
        var x=10;
        return function(){             //函数嵌套函数
                x++;
                alert(x);
        }
}
var y = outer();              //外部函数赋给变量y;
y();                 //y函数调用一次,结果为11,相当于outer()();
y();                //y函数调用第二次,结果为12,实现了累加
</script>

Edit page
Share this post on:

Previous Post
30岁的自己
Next Post
oneWeekMac