Skip to content

Instantly share code, notes, and snippets.

Link linkdesu

Block or report user

Report or block linkdesu

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
@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 - cors
Last active Aug 11, 2016 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
View nginx.conf - cors
#
# 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 / which_system.sh
Created Mar 7, 2016
获取当前 Linux 发行版版本号
View which_system.sh
# 所有遵守LSB规范的的linux
lsb_release -a
@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 Oct 9, 2019
Ubuntu sources.list for China
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 Aug 18, 2019 — 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 必须全部由字母、数字、中划线或下划线字符构成',
@linkdesu
linkdesu / Yii2_built-in-rules
Last active Sep 5, 2015
Yii2 model built in validators used in $rules property .
View Yii2_built-in-rules
public $builtInValidators = [
'boolean' => 'yii\validators\BooleanValidator',
'captcha' => 'yii\captcha\CaptchaValidator',
'compare' => 'yii\validators\CompareValidator',
'date' => 'yii\validators\DateValidator',
'default' => 'yii\validators\DefaultValueValidator',
'double' => 'yii\validators\NumberValidator',
'each' => 'yii\validators\EachValidator',
'email' => 'yii\validators\EmailValidator',
'exist' => 'yii\validators\ExistValidator',
You can’t perform that action at this time.