Skip to content

Instantly share code, notes, and snippets.

View szy0syz's full-sized avatar
🐽
busy

Zhenyu Shi szy0syz

🐽
busy
View GitHub Profile
@szy0syz
szy0syz / ShadowSocks-filters.md
Last active January 2, 2024 13:45
MAC ShadowSocks 自定义规则

ShadowSocks 自定义规则

ShadowSocks 规则格式说明

ShadowSocks 默认使用的 [GFWList][1] 规则,这里有一份 [gfwlist2pac][2]。

ShadowSocks 默认使用的是 adblock plus 的引擎,要想自己添加规则最好熟悉一下其规则,下面是ShadowSocks 的 pac 规则。

中文版: [Adblock Plus 过滤规则][3] 英文版: [Adblock Plus filters explained][4]

@szy0syz
szy0syz / String_extension.js
Created July 30, 2017 07:48
JavaScript String extension
String.prototype.queryURLParams = function () {
let obj = {},
reg = /([^?=&#]+)=([^?=&#]+)/g;
this.replace(reg, function () {
// arguments[0] === this
const key = arguments[1];
obj[key] = arguments[2];
});
return obj;
};
@szy0syz
szy0syz / Array_extension.js
Created July 30, 2017 07:57
JavaScript array extension
//////////////////////////
Object.defineProperty(Array.prototype, 'group', {
enumerable: false,
value: function (key) {
var map = {};
this.forEach(function (e) {
var k = key(e);
map[k] = map[k] || [];
map[k].push(e);
})
@szy0syz
szy0syz / szy0syz-mac-init.md
Last active October 25, 2017 02:36
szy0syz-mac-init

szy0syz-mac-init

我的Mac初始化步骤记录

① installation

  • oh-my-zsh

    • sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  • Apps

  • Alfred

@szy0syz
szy0syz / css-reset.css
Last active December 13, 2021 07:51
css-reset from 《HTML5布局之路》
@charset "utf-8"; /*表示定义CSS文件的字符编码格式为"utf-8"*/
/*为HTML元素定义样式:字体颜色为黑色,背景颜色为白色,字体类型为"微软雅黑、sans-serif、Arial"三种*/
html {
color: #000;
background: #fff;
font-family: 'Microsoft YaHei', sans-serif, Arial;
}
/*为body、div等元素设置内边距为零、外边距为零、字体类型为"微软雅黑、sans-serif、Arial"三种*/
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, button, textarea, p, blockquote, th, td, strong {
@szy0syz
szy0syz / es6.js
Created December 23, 2017 14:08
ES6常用代码片段
let arr;
let arr1, arr2, myList;
// [数组]
// 遍历数据
[1, 2, 3].forEach((value, index) => {
console.log(value, index);
});
// 映射新数据
arr = [1, 2, 3].map(v => v * 2);
// 所有元素是否通过测试
@szy0syz
szy0syz / wxapp-record.md
Created April 25, 2018 09:03
微信小程序采坑记录

微信小程序采坑记录

@szy0syz
szy0syz / cloudSettings
Last active January 11, 2021 02:57
vscode-settings
{"lastUpload":"2021-01-11T02:57:24.487Z","extensionVersion":"v3.4.3"}
@szy0syz
szy0syz / RoleList.vue
Created October 28, 2019 08:29
Vue 片段
<template>
<div class="container">
<template v-for="(item, idx) in list">
<div class="item" :key="item.id">
<i class="icon" @click="() => {onRemove(idx)}">
<i class="icon-del"></i>
</i>
<span class="desc">{{item.name}}</span>
</div>
<i class="separtor" v-if="list.length -1 > idx" :key="item.id"></i>
@szy0syz
szy0syz / styled.js
Created January 9, 2020 04:05
Reusing CSS With Styled Components
import styled, { css } from ‘styled-components’;
export const DefaultInput = styled.input`
border: 1px solid ${({error})=>( error ? `red` : `grey` )};
border-radius: 4px;
outline: none;
padding: 0.5em;
`;
export const SecondComponent = styled(DefaultInput)`