Skip to content

Instantly share code, notes, and snippets.

@CzBiX
CzBiX / renamer.py
Last active September 2, 2015 03:39
batch rename files with regex
#!/usr/bin/env python3
import errno
__author__ = 'czbix'
import argparse
import os
import re
import glob
@CzBiX
CzBiX / v2ex.css
Last active April 1, 2017 04:55
Material design for V2EX
#Bottom {
box-shadow:0 0 4px rgba(0,0,0,0.14), 0 4px 8px rgba(0,0,0,0.28);
}
#Main .box:nth-child(-2n+4):not(.transparent) {
box-shadow:0 0 6px rgba(0,0,0,.16),0 6px 12px rgba(0,0,0,.32);
}
#Search div {
@CzBiX
CzBiX / Feedback.php
Created February 27, 2014 06:59
Filter spam comment in Typecho, file path: /var/Widget/Feedback.php, line 82
<?php
if(!$this->user->hasLogin()) {
/** 过滤纯英文评论 */
$pattern = '/[\x{4E00}-\x{9FA5}]/u';
if (!preg_match($pattern, $comment['text'], $match)) {
throw new Typecho_Widget_Exception(_t('You should type some Chinese word (like "你好") in your comment to pass the spam-check, thanks for your patience!<br />您的评论中必须包含汉字!<p><a style="color:#FFF; border: 1px solid;text-decoration:none;padding:0px 2px" href="javascript:void(history.back())">点此返回</a></p>'));
}
/** 过滤包含日文的评论 */
$pattern = '/[\x{3040}-\x{31FF}]/u';