Skip to content

Instantly share code, notes, and snippets.

View MarvinXu's full-sized avatar

Marvin MarvinXu

  • 07:06 (UTC +08:00)
View GitHub Profile
# proxy
export all_proxy="http://$(hostname).local:7890"
export no_proxy="localhost,127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
# alias
##
# GitAlias.com file of many git alias items, including shortcuts, helpers, workflows, etc.
#
#
# ## Usage
#
# Typical usage for a typical user:
#
# * Save this file as a dot file in your home directory: `~/.gitalias.txt`
#
@MarvinXu
MarvinXu / mask-rendering-issue.html
Last active April 3, 2022 07:25
Chrome `-webkit-mask` and `scale3d` rendering issue
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
:root{
--icon: url("data:image/svg+xml;utf8,%3Csvg preserveAspectRatio='xMidYMid meet' viewBox='0 0 32 32' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M16 10v12v-12m1-1h-5v2h3v10h-3v2h8v-2h-3V9Z'/%3E%3C/svg%3E");
@MarvinXu
MarvinXu / LazyMan.js
Created March 31, 2022 13:52
Method chaining & task queue
class LazyManClass {
constructor(name) {
this.name = name
this.tasks = []
setTimeout(() => {
this.flush()
})
}
flush() {
let seq = Promise.resolve()
Function.prototype.bind = function (thisArg) {
var fn = aFunction(this),
slice = [].slice,
partArgs = slice.call(arguments, 1),
boundF
boundF = function () {
var args = partArgs.concat(slice.call(arguments))
var arr = []
for (var i = 0; i < args.length; i++) {
.icon-x{
&:before,&:after{
content: "";
position: absolute;
width: pxToRem(20px);
height: 1px;
background-color: #fff;
}
&:before{
transform: rotate(45deg);
@MarvinXu
MarvinXu / commfy0.js
Last active August 29, 2015 14:06 — forked from hotoo/commfy0.js
function commfy0(n){
var a = n.toString().split(".");
var i = a[0].length%3;
var prefix = (a[0].substr(0,i)+a[0].substr(i).replace(/(\d{3})/g,",$1")).replace(/^,/, "");
//var postfix = a[1] ? "."+a[1].replace(/(\d{3})/g, "$1,").replace(/,$/, "") : "";
return prefix+(a[1]?"."+a[1]:"");
}