An exploration of the different render methods available in react-enzyme.
var Types = new Map(); | |
Types.set(Array, function(v) { | |
var l = v.length; i = 0, a = Array(l); | |
for (i; i<l; i++) { | |
a[i] = v[i]; | |
} | |
return a; | |
}); | |
Types.set(Number, function(v) { | |
return v * 1; |
/** | |
* 截取指定长度的中英文混合字符串 | |
* @param {String} str 待截取的字符串 | |
* @param {Number} n 截取长度(中文字符为英文的 double) | |
* @return {String} 截取后的字符串 | |
*/ | |
function subString(str, n) { | |
var r = /[^\x00-\xff]/g; | |
var m; |
Charles Proxy Map Remote over HTTP or HTTPS
The Map Remote tool changes the request location, per the configured mappings, so that the response is transparently served from the new location as if that was the original request.
Using this feature for http
resources does't require anything else apart from just configuring your Map Remote entry.
Always make sure you are clearing your cache before you test. Even if Charles is configured properly you might not see the changes unless the browser gets the resource again from the server and not for its local cache.
// {{#nl2br}} replace returns with <br> | |
Handlebars.registerHelper('nl2br', function(options) { | |
var nl2br = (options.fn(this) + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + '<br>' + '$2'); | |
return new Handlebars.SafeString(nl2br); | |
}); | |
/** | |
* {{#ifGt}} greater than helper | |
* | |
* @param1 int param1 |
#关于 PAC 的书签夹
###比较全的 PAC 介绍
- http://www.proxypacfiles.com/proxypac/ 入门必看(英文)
- http://findproxyforurl.com/ 跟上面的类似(英文)
- http://wordpress0.com/2011/06/write-pac-file/ (汉语)内容比较全(尤其是附录)
- 代理自动配置 维基百科
- https://calomel.org/proxy_auto_config.html Calomel写的的实用性介绍
class PubSub { | |
constructor() { | |
this.handlers = []; | |
} | |
subscribe(event, handler, context) { | |
if (typeof context === 'undefined') { | |
context = handler; | |
} | |
<!-- Prevent FOUC (flash of unstyled content) - http://johnpolacek.com/2012/10/03/help-prevent-fouc/ --> | |
<style type="text/css"> | |
.no-fouc {display: none;} | |
</style> | |
<script type="text/javascript"> | |
document.documentElement.className = 'no-fouc'; | |
// add to document ready: $('.no-fouc').removeClass('no-fouc'); | |
</script> |
This shows an example of a responsive table that utilizes flexbox for it's layout.
Moved from my old account to new: Forked from Ian Svoboda's Pen vIqnD.
A Pen by Ian Svoboda on CodePen.
Custom recipe to get OS X 10.11 El Capitan running from scratch, setup applications and developer environment. This is very similar (and currently mostly the same) as my 10.10 Yosemite setup recipe (as found on this gist https://gist.github.com/kevinelliott/0726211d17020a6abc1f). Note that I expect this to change significantly as I install El Capitan several times.
I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.
This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.
You are encouraged to fork this and modify it to your heart's content to match your own needs.