Skip to content

Instantly share code, notes, and snippets.

Minwe LUO minwe

Block or report user

Report or block minwe

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
@minwe
minwe / objectdeepcopy.js
Created Mar 13, 2019 — forked from izy521/objectdeepcopy.js
`JSON.parse( JSON.stringify( obj) )` has been regarded as the fastest method for deep copying Objects, but is it? This is mainly just to test. Obviously Functions aren't allowed in JSON.
View objectdeepcopy.js
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;
@minwe
minwe / !react-enzyme-render-methods.md
Created Mar 20, 2018 — forked from borela/!react-enzyme-render-methods.md
react-enzyme - `shallow` vs `mount` vs `render` lifecycle methods
View !react-enzyme-render-methods.md

An exploration of the different render methods available in react-enzyme.

@minwe
minwe / subString.js
Created Jul 27, 2017 — forked from roshanca/subString.js
截取指定长度的中英文混合字符串
View subString.js
/**
* 截取指定长度的中英文混合字符串
* @param {String} str 待截取的字符串
* @param {Number} n 截取长度(中文字符为英文的 double)
* @return {String} 截取后的字符串
*/
function subString(str, n) {
var r = /[^\x00-\xff]/g;
var m;
@minwe
minwe / charles-map-remote.md
Created Jul 13, 2017 — forked from radum/charles-map-remote.md
Charles proxy Map Remote over HTTP or HTTPS
View charles-map-remote.md

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.

HTTP

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.
@minwe
minwe / helpers.js
Created Jun 8, 2017 — forked from AlexPashley/helpers.js
JS: Handlebars - Block Helpers #1 nl2br - Replace returns with <br> #2 If Greater than comparison operator #3 Find and replace function
View helpers.js
// {{#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
View 关于 PAC 的书签夹.md
View simple-pubsub.es6.js
class PubSub {
constructor() {
this.handlers = [];
}
subscribe(event, handler, context) {
if (typeof context === 'undefined') {
context = handler;
}
View gist:4f3918669869fb5cea3c13e4e53e0f9f
<!-- 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>
View Responsive-Flexbox-table-with-Fallback.markdown

Responsive Flexbox table with Fallback

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.

License.

@minwe
minwe / osx-10.11-setup.md
Created Nov 21, 2015 — forked from kevinelliott/osx-10.11-setup.md
Mac OS X 10.11 El Capitan Setup
View osx-10.11-setup.md

Mac OS X 10.11 El Capitan

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.

You can’t perform that action at this time.