Skip to content

Instantly share code, notes, and snippets.

@ZoeyYoung
ZoeyYoung / dabblet.css
Created October 10, 2016 10:17 — forked from csssecrets/dabblet.css
Native modal dialog (limited support)
/**
* Native modal dialog (limited support)
*/
dialog::backdrop {
background: rgba(0,0,0,.8)
}
@ZoeyYoung
ZoeyYoung / DatabaseDriver.java
Created October 29, 2014 03:51
Java从Json文件中读取数据并封装成对象
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.io.FileUtils;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
@ZoeyYoung
ZoeyYoung / LogUtil.java
Last active August 29, 2015 14:08
动态创建logger,例如根据不同的ID创建不同的Log文件
import java.io.File;
import java.io.IOException;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
import org.apache.log4j.RollingFileAppender;
public final class LogUtils {
@ZoeyYoung
ZoeyYoung / jQuery.MultipleLevelSelector.js
Last active August 29, 2015 14:07
Select联动菜单代码,通过设置Json来改变选项
(function($){
var defaults = {
id: "s1",
splitStr: "-"
};
var opts = {};
var methods = {
init: init,
getValue: function getSelectValue() {
var selects = $(this).find('select');
@ZoeyYoung
ZoeyYoung / eclipse.ini
Created April 22, 2014 06:11
eclipse.ini example
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20130521-0416
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
@ZoeyYoung
ZoeyYoung / PasswordUtils.java
Last active August 29, 2015 14:00
《Thinking In Java》注解定义、使用与编写注解处理器 简例
package annotations;
//: annotations/PasswordUtils.java
// 使用注解
import java.util.*;
public class PasswordUtils {
@UseCase(id = 47, description = "Passwords must contain at least one numeric")
public boolean validatePassword(String password) {
return (password.matches("\\w*\\d\\w*"));
@ZoeyYoung
ZoeyYoung / OpenCmdHere.reg
Created April 18, 2014 03:30
Open cmd here as Admin
Windows Registry Editor Version 5.00
; Created by: Shawn Brink
; http://www.sevenforums.com
; Tutorial: http://www.sevenforums.com/tutorials/47415-open-command-window-here-administrator.html
[-HKEY_CLASSES_ROOT\Directory\shell\runas]
[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Open cmd here as Admin"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""
@ZoeyYoung
ZoeyYoung / Preferences.sublime-settings
Last active December 21, 2015 17:09
Sublime Text 3 User Setting
{
"auto_complete_commit_on_tab": true,
"bold_folder_labels": true,
"color_scheme": "Packages/User/Monokai Soda.tmTheme",
"default_line_ending": "unix",
"draw_minimap_border": true,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
"fade_fold_buttons": false,
"folder_exclude_patterns":
@ZoeyYoung
ZoeyYoung / encoding.py
Created July 31, 2013 10:42
Python: 编码识别
import logging
import re
import chardet
from bs4 import UnicodeDammit
LOG = logging.getLogger()
BROTHER_ENCODINGS = [
('GB2312', 'GBK', 'GB18030'),
@ZoeyYoung
ZoeyYoung / gist:6078034
Last active December 20, 2015 05:28
Python: 正则表达式, 去除HTML标签中无用属性
import re
bad_attrs = ['width', 'height', 'style', '[-a-z]*color',
'background[-a-z]*', 'on*']
single_quoted = "'[^']+'"
double_quoted = '"[^"]+"'
non_space = '[^ "\'>]+'
cstr = ("<" # open
"([^>]+) " # prefix
"(?:%s) *" % ('|'.join(bad_attrs),) + # undesirable attributes