This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding=utf-8 | |
import os | |
import plistlib | |
import bplist | |
from datetime import datetime | |
import shutil | |
import xml | |
out_dir = None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function() {$('<button type="button" class="btn btn-numbering">标题重新编号</button>') .appendTo($('.save-btns-wrap .form-field')) .click(function() {var numbers = [0, 0, 0, 0, 0, 0]; $('H1,H2,H3,H4,H5,H6', $('.simditor-body')).each(function(i, e) {var level = parseInt(e.tagName[1]); numbers[level - 1] += 1; for (var i = level; i < numbers.length; i++) {numbers[i] = 0; } var prefix = numbers.slice(0, level).join('.'); e = $(e); var title = e.text(); if (!title.startsWith(prefix)) {title = title.replace(/^(\d\.)*\d\s?/, ''); e.text(prefix + ' ' + title); } }); }); })() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface CTResizeableTabBar : UITabBar | |
// tabbar高度,为0表示采用系统默认高度 | |
- (instancetype)initWithHeight:(CGFloat)tabBarHeight; | |
@end | |
@interface CTResizeableTabBar () |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.management.commands.shell import Command as ShellCommand | |
import os | |
class Command(ShellCommand): | |
shells = ShellCommand.shells.append('ptpython') | |
def ptpython(self): | |
try: | |
# old ptpython |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from subprocess import Popen, PIPE | |
def chs2cht(chs): | |
return Popen(['opencc'], stdout=PIPE, stdin=PIPE).communicate(chs)[0][:-1] | |
print chs2cht('简体') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -maxdepth 3 | xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add `defaults read /Applications/Xcode.app/Contents/Info.plist DVTPlugInCompatibilityUUID` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.WB_cardwrap { | |
margin-bottom: 0; | |
} | |
.WB_tab_a { | |
margin-bottom: 0; | |
} | |
.send_weibo { | |
margin-bottom: 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Here are .plist files defining system fonts. | |
NSFileManager *fileMgr = [NSFileManager defaultManager]; | |
NSArray *files = [fileMgr contentsOfDirectoryAtPath:@"/System/Library/Fonts/" error:NULL]; | |
NSLog(@"%@", files); | |
// Choose one .plist file. The filename depends on iOS version. | |
NSDictionary *fontCache = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/Fonts/[email protected]"]; | |
NSLog(@"%@", fontCache); | |
// Copy font files to App directory for free access. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation NSString (XMLSafe) | |
- (NSString *)xmlSafeString { | |
static NSMutableCharacterSet *invalidSet = nil; | |
if (!invalidSet) { | |
// XML Character Range definition (http://www.w3.org/TR/2008/REC-xml-20081126/#charsets) | |
// Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] | |
invalidSet = [[NSMutableCharacterSet characterSetWithRange:NSMakeRange(0x9, 1)] retain]; | |
[invalidSet addCharactersInRange:NSMakeRange(0xA, 1)]; | |
[invalidSet addCharactersInRange:NSMakeRange(0xD, 1)]; |