半年前参加黑客马拉松,觉得好玩就做了个在线版的简历,在知乎上安利了一下后,竟然小火了一把,至今已获得了超过 16000 次浏览。这次准备简历的时候,简单更新了一下在线版的简历,然后用 PhotoShop 做了一页打印版的简历。之前也有考虑用 Word 做好再导出成 PDF,但是 Mac 下的 Word 实在用起来太捉急了,对齐微调什么的搞得我抓狂了,最终还是折中一下用了 PhotoShop 做,缺点就是导出的 PDF 没有超链接了,实在有点遗憾。效果如下:
Like most modern programming languages, JavaScript uses lexical scoping. This means that functions are executed using the variable scope that was in effect when they were defined, not the variable scope that is in effect when they are invoked. In order to implement lexical scoping, the internal state of a JavaScript function object must in- clude not only the code of the function but also a reference to the current scope chain. (Before reading the rest of this section, you may want to review the material on variable scope and the scope chain in §3.10 and §3.10.3.) This combination of a function object and a scope (a set of variable bindings) in which the function’s variables are resolved is called a closure in the computer science literature. (This is an old term that refers to the fact that the function’s variables have bindings in the scope chain and that therefore the function is “closed over” its variables.)
Technically, all JavaScript functions are closures: they are objects, and they have a scope chain associated with them. Most functions are invoked using the same scope chain that was in effect when the function was defined, and it doesn’t really matter that there is a closure involved. Closures become interesting when they are invoked under a different scope chain than the one that was in effect when they were defined. This happens most commonly when a nested function object is returned from the function within which it was defined. There are a number of powerful programming techniques that involve this kind of nested function closures, and their use has become relatively common in JavaScript programming. Closures may seem confusing when you first en- counter them, but it is important that you understand them well enough to use them comfortably.
摘自 JavaScript, The Definite Guide
RESTful 的操作名
增删改查?
应该是 GET, POST, DELETE 等,当时有点不知道在问什么……
HTTP 404、302、500、403 状态名是什么意思
404:文件找不到;302:不知道;500:服务器错误;403:权限错误。
302 Found 是HTTP协议中的一个状态码(Status Code)。可以简单的理解为该资源原本确实存在,但已经被临时改变了位置;或者换个说法,就是临时的存在于某个临时 URL 下。通常会发送 Header 来暂时重定向到新的新位置。
摘自 http://zh.wikipedia.org/wiki/HTTP_302
不能,在默认情况下 JavaScript 的加载是阻塞的,前面的 JavaScript 请求没有处理、执行完,是会阻塞 DOM tree 的解析等的,需要 JavaScript 代码完全获取到并执行完毕才继续。
一个更漂亮的回答应该再扯一点 defer、async 呀!
CSS 的加载是异步的吗?表现在什么地方?
是的,表现在不阻塞 DOM tree 的解析,并且可以同时加载多个 CSS 文件。
这个答案应该是错误的。
By default CSS is treated as a render blocking resource, which means that the browser will hold rendering of any processed content until the CSSOM is constructed. Make sure to keep your CSS lean, deliver it as quickly as possible, and use media types and queries to unblock rendering.
In the previous section we saw that the critical rendering path requires that we have both the DOM and the CSSOM to construct the render tree, which creates an important performance implication: both HTML and CSS are render blocking resources.
Finally, note that “render blocking” only refers to whether the browser will have to hold the initial rendering of the page on that resource. In either case, the CSS asset is still downloaded by the browser, albeit with a lower priority for non-blocking resources.
摘自 Render Blocking CSS
When invoked in this manner, the function context is the global context—the window object.
Invocation as a method
varo={};o.whatever=function(){};o.whatever();
When we invoke the function as the method of an object, that object becomes the function context and is available within the function
via the this parameter.
Invocation as a constructor
functioncreep(){returnthis;}newcreep();
Invoking a function as a constructor is a powerful feature of JavaScript, because when a constructor is invoked, the following special actions take place:
A new empty object is created.
This object is passed to the constructor as the this parameter, and thus becomes the constructor’s function context.
In the absence of any explicit return value, the new object is returned as the constructor's value.
Invocation with the apply() and call() methods
functionjuggle(){varresult=0;for(varn=0;n<arguments.length;n++){result+=arguments[n];}this.result=result;}varninja1={};varninja2={};juggle.apply(ninja1,[1,2,3,4]);juggle.call(ninja2,5,6,7,8);assert(ninja1.result===10,"juggled via apply");assert(ninja2.result===26,"juggled via call");
To invoke a function using its apply() method, we pass two parameters to apply(): the object to be used as the function context, and an array of values to be used as the invocation arguments. The call() method is used in a similar manner, except that the arguments are passed directly in the argument list rather than as an array.