Skip to content

Instantly share code, notes, and snippets.

@ZoeyYoung
ZoeyYoung / class_comment.py
Created June 9, 2013 11:19
Python: 类注释模板,取自Google Python Style Guide
class SampleClass(object):
"""Summary of class here.
Longer class information....
Longer class information....
Attributes:
likes_spam: A boolean indicating if we like SPAM or not.
eggs: An integer count of the eggs we have laid.
"""
@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 / 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 / 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 / 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
@ZoeyYoung
ZoeyYoung / config
Created July 13, 2013 01:35
SublimeCodeIntel config
{
"Python": {
"python": '/usr/bin/python',
"pythonExtraPaths": ["C:\Python27"]
},
"Python3": {
"python": '/usr/bin/python3',
"pythonExtraPaths": ["C:\Python33"]
}
}
@ZoeyYoung
ZoeyYoung / 设置默认文件夹.reg
Created July 10, 2013 17:00
Windows: 设置默认文件夹
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders]
"Desktop"="F:\\Desktop"
"Favorites"="E:\\Favorites"
"My Music"="E:\\Music"
"My Pictures"="E:\\Pictures"
"My Video"="E:\\Videos"
"Personal"="E:\\Documents"
"{374DE290-123F-4565-9164-39C4925E467B}"="E:\\Downloads"
@ZoeyYoung
ZoeyYoung / gist:5894319
Last active December 19, 2015 03:59
Tornado: How2 Print a date in a tornado template from a Mongodb ObjectId
{{locale.format_date(c['_id'].generation_time.replace(tzinfo=None), -480, relative=False)}}
@ZoeyYoung
ZoeyYoung / Monokai Soda.tmTheme
Last active December 19, 2015 03:59
Sublime Text: Monokai Sode.tmTheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Monokai Soda</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@ZoeyYoung
ZoeyYoung / pelicanconf.py
Created June 26, 2013 09:33
Pelican: 配置
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = 'ZoeyYoung'
AUTHOR_EMAIL = 'ydingmiao@gmail.com'
EMAIL = 'ydingmiao@gmail.com'
SITENAME = 'OK Computer'
SITESUBTITLE = "It's better to burn out <br/> than to fade away."
SITEURL = 'http://zoeyyoung.gitcafe.com'