Skip to content

Instantly share code, notes, and snippets.

View xhacker's full-sized avatar
🌀

柳东原 · Dongyuan Liu xhacker

🌀
View GitHub Profile
@xhacker
xhacker / update-git-repos.sh
Created December 9, 2014 08:21
Update Git repos in directory
find . ! -path . -maxdepth 1 -type d -exec sh -c '(cd {} && pwd && git pull)' ';'
@xhacker
xhacker / migrate.py
Last active August 29, 2015 14:13
This script migrates Inboard beta library to Inboard App Store version library.
#!/usr/bin/env python
"""This script migrates Inboard beta library to Inboard App Store version
library."""
import sqlite3
import os
from os.path import expanduser
import subprocess
import shutil
@xhacker
xhacker / UIAppearance+Swift.m
Created September 6, 2015 14:49
appearanceWhenContainedIn: for Swift
#import "UIAppearance+Swift.h"
@implementation UIView (UIViewAppearance_Swift)
+ (instancetype)swift_appearanceWhenContainedIn:(NSArray *)containerClasses
{
NSUInteger count = containerClasses.count;
NSAssert(count <= 10, @"The count of containers greater than 10 is not supported.");
return [self appearanceWhenContainedIn:
/*
Copyright (C) 2015 Apple Inc. All Rights Reserved.
See LICENSE.txt for this sample’s licensing information
Abstract:
The application delegate class used to manage this sample.
*/
import UIKit
@xhacker
xhacker / style.css
Last active February 4, 2017 15:17
Better style for Stash
body,
textarea {
font-family: -apple-system !important;
-webkit-font-smoothing: subpixel-antialiased !important;
}
pre,
code,
.line-number,
.blame,
@xhacker
xhacker / retinalize.sh
Created February 15, 2017 09:23
Convert image to a 2x image
retinalize() { convert -density 144 -units pixelsperinch "$1" "$1" }
NSArray *cascadeList = @[[UIFontDescriptor fontDescriptorWithName:@"Helvetica" size:20.0],
[UIFontDescriptor fontDescriptorWithName:@"PingFangTC-Regular" size:20.0]];
CTFontDescriptorRef descriptor = CTFontDescriptorCreateWithAttributes((CFDictionaryRef) @{(id)kCTFontCascadeListAttribute: cascadeList});
UIFont *font = (__bridge_transfer UIFont *) CTFontCreateWithFontDescriptor(descriptor, 20, NULL);
CFRelease(descriptor);
self.label.font = font;
self.label.text = @"Helvetica fallback 到 PingFangTC-Regular 汉体书写信息技术标准相容档案下载使用界面简单支援服务升级资讯专业制作创意空间快速无线上网";