eeAiiZooAuuZZeeeZZfff
- A[^Z]*ZZ yields 1 match: AuuZZ
- A.*?ZZ yields 1 match: AiiZooAuuZZ
- A.*ZZ yields 1 match: AiiZooAuuZZeeeZZ
source: http://stackoverflow.com/questions/3075130/difference-between-and-for-regex
| function strIndexOf(val, str) { | |
| val = String(val); | |
| var strLen = str.length; | |
| if (strLen >= val.length) { | |
| var head = val[0] | |
| var hasHead = -1; | |
| var matchLen = 0; | |
| for (var i = 0; i < strLen; i++) { | |
| var v = str[i]; |
| function remove(str){ | |
| var sCR = /(\/\/(.*)$)/gm; | |
| var bCR = /(\/\*([\s\S]*?)\*\/)/gm; | |
| bst eR = /^\s*[\r\n]/gm; | |
| return str.replace(sCR, '') | |
| .replace(bCR, '') | |
| .replace(eR, ''); | |
| } |
| <!doctype html> | |
| <html> | |
| <head> | |
| <title>iFrame memory leak prevention test</title> | |
| </head> | |
| <body> | |
| <h1>iFrame memory leak prevention test (void)</h1> | |
| <p>In IE up through version 8 adding an iframe to a page and | |
| removing it produces a memory leak in some cases. The pattern |
eeAiiZooAuuZZeeeZZfff
source: http://stackoverflow.com/questions/3075130/difference-between-and-for-regex
| $.fn.serializeObject = function() { | |
| var o = {}; | |
| var a = this.serializeArray(); | |
| $.each(a, function() { | |
| if (o[this.name]) { | |
| if (!o[this.name].push) { | |
| o[this.name] = [o[this.name]]; | |
| } | |
| o[this.name].push(this.value || ''); | |
| } else { |
| server { | |
| listen 80; | |
| server_name wx.example.com; | |
| location / { | |
| proxy_pass http://localhost:1336; | |
| proxy_http_version 1.1; | |
| proxy_set_header Upgrade $http_upgrade; | |
| proxy_set_header Connection 'upgrade'; |
| $(window).on('unload', function() { | |
| $(window).scrollTop(0); | |
| }); | |
| window.onunload = function(){ window.scrollTo(0,0); } | |
| if ('scrollRestoration' in history) { | |
| history.scrollRestoration = 'manual'; | |
| } |
| var status = '.status-0' | |
| console.log(status.substr(2,2)); //first param by begin, second by cut length, got 'ta' | |
| console.log($(this).attr('data-filter').substring(2,4)); // first param by begin index, second by sub index string. got 'ta' also . |
| var values = [ | |
| { name: 'someName1' }, | |
| { name: 'someName2' }, | |
| { name: 'someName4' }, | |
| { name: 'someName2' } | |
| ]; | |
| var valueArr = values.map(function(item){ return item.name }); | |
| var isDuplicate = valueArr.some(function(item, idx){ | |
| return valueArr.indexOf(item) != -1; |
#Cache-Control适用场合 该参数用于缓存控制,在设置了该值后,浏览器会在超过该时间的情况下强行请求一次服务器,否则会一直使用上一次访问时的数据。 例如max-age=60,这里就告诉了浏览器在60秒内可以使用缓存,超过后需要重新向服务器发送请求。 这里要注意的事文件的访问方式局限于该文件是被其它文件所调用,或者是在新窗口访问该文件,如果在访问单个文件时使用了浏览器上的刷新按钮,那么就会浏览器就会强行触发一次发向服务器的请求。 这也就为什么很多人发现Cache-Control设置失效的原因。
#ETag的作用 该值一般是由服务器端生成的一段随机代码,用于指示当前访问文件的特殊值(文件的任何改变都会导致其改变)。一般用于校验当前文件是否是最新的文件。
#Cache-Control结合ETag的用法