Skip to content

Instantly share code, notes, and snippets.

Avatar

Link linkdesu

View GitHub Profile
@linkdesu
linkdesu / cheatsheet.md
Last active May 5, 2022
[linux] #cheatsheet
View cheatsheet.md

Linux

常用操作

Proxy

export ALL_PROXY=socks5h://127.0.0.1:6156/
@linkdesu
linkdesu / cheatsheet.md
Last active Apr 11, 2022
[vim] #cheatsheet
View cheatsheet.md

Config

Show version

:ve

Solve indent problems when pasting

:set paste

turn line number on/off

:set nu

@linkdesu
linkdesu / summonEruda.js
Last active Sep 27, 2019
Summon eruda devtool when you cast the spell.
View summonEruda.js
;(function () {
var step = 0
function load (url, callback) {
var script = document.createElement('script');
script.src = url;
script.onload = callback;
document.body.appendChild(script);
}
function summonEruda (e) {
if (e.target.dataset && e.target.dataset.summonEruda) {
@linkdesu
linkdesu / isEmail.js
Created Jul 24, 2018
Email Validation Regex
View isEmail.js
/**
* Follow the description from wiki https://en.wikipedia.org/wiki/Email_address
*
* Valid test address:
*
simple@example.com
very.common@example.com
disposable.style.email.with+symbol@example.com
other.email-with-hyphen@example.com
fully-qualified-domain@example.com
@linkdesu
linkdesu / RexChainesPhone.js
Last active Jul 19, 2018 — forked from JerryC8080/RexChainesPhone.js
匹配中国电话号码的正则表达式
View RexChainesPhone.js
/^1[3-9](\d{9})$/.test(phone)
@linkdesu
linkdesu / nginx.conf
Last active Jul 10, 2021 — forked from Stanback/nginx.conf
[nginx-cross-origin] Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs #nginx #conf
View nginx.conf
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your location block(s):
#
# include cors_support;
#
# For more information on CORS, please see: http://enable-cors.org/
@linkdesu
linkdesu / scorePassword.js
Created Feb 20, 2016
Js - Score password .
View scorePassword.js
/**
* Score password
*
* Usage:
* var score = scorePassword(password);
* if (strength >= 80) {
* // strong
* } else if (strength >= 60) {
* // good
* } else {
@linkdesu
linkdesu / format.js
Last active Feb 20, 2016
Js - String.format
View format.js
if (!String.prototype.format) {
/**
* Add format function to String
*
* Usage:
* "{0} is dead, but {1} is alive! {0} {2}".format("ASP", "ASP.NET")
* returns ASP is dead, but ASP.NET is alive! ASP {2}
*
* Come from: http://stackoverflow.com/a/4673436/4472903
*/
@linkdesu
linkdesu / Ubuntu_sources.list
Last active Jul 10, 2021
[ubuntu sources] Ubuntu sources.list for China #ubuntu #mirror
View Ubuntu_sources.list
# 如果有需要,根据系统版本将 vivid 替换为 utopic, trusty, precise 等即可
# 163, sohu, aliyun 三者开启其一即可,个人测试觉得 163 最快
# aliyun
deb http://mirrors.aliyun.com/ubuntu/ vivid main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid main restricted universe multiverse
@linkdesu
linkdesu / Laravel_validation.php
Last active May 2, 2021 — forked from chareice/validation.php
Localization Validation Message For Chineses With Laravel 5
View Laravel_validation.php
<?php
return [
'unique' => ':attribute 已存在',
'accepted' => ':attribute 是被接受的',
'active_url' => ':attribute 必须是一个合法的 URL',
'after' => ':attribute 必须是 :date 之后的一个日期',
'alpha' => ':attribute 必须全部由字母字符构成。',
'alpha_dash' => ':attribute 必须全部由字母、数字、中划线或下划线字符构成',