Skip to content

Instantly share code, notes, and snippets.


Shawn Wang iShawnWang

View GitHub Profile
rbaulin / UIImage+ImageEffects.h
Last active Jan 9, 2017
UIImage+ImageEffects.m presented on WWDC 2013
View UIImage+ImageEffects.h
File: UIImage+ImageEffects.h
Abstract: This is a category of UIImage that adds methods to apply blur and tint effects to an image. This is the code you’ll want to look out to find out how to use vImage to efficiently calculate a blur.
Version: 1.0
Copyright (C) 2013 Apple Inc. All Rights Reserved.
@import UIKit;
daehn / vibration.m
Created Apr 3, 2015
Custom iOS vibration pattern with 100ms duration using private API
View vibration.m
NSMutableDictionary *vibrationParameters = [[NSMutableDictionary alloc] init];
vibrationParameters[@"VibePattern"] = @[@YES, @100];
vibrationParameters[@"Intensity"] = @1;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-function-declaration"
AudioServicesPlaySystemSoundWithVibration(kSystemSoundID_Vibrate, nil, vibrationParameters);
#pragma clang diagnostic pop
dimroc / DDLogHelper.swift
Last active Jul 28, 2017
Wrapper around the Objective C DDLog found in CocoaLumberjack 2.x
View DDLogHelper.swift
import Foundation
public let defaultDebugLevel = DDLogLevel.Debug
public let defaultTag = NSString(format: "ManhattanForum")
class DDLogHelper {
class func SwiftLogMacro(async: Bool, level: DDLogLevel, flag flg: DDLogFlag, context: Int = 0, file: String = __FILE__, function: String = __FUNCTION__, line: UWord = __LINE__, tag: AnyObject? = defaultTag, format: String, args: CVaListPointer) {
let string = NSString(format: format, arguments: args) as String
SwiftLogMacro(async, level: level, flag: flg, context: context, file: file, function: function, line: line, tag: tag, string: string)
webfrogs /
Created Mar 30, 2017
Output swift function information whose compile time is large than 100ms
xcodebuild -workspace XXX.xcworkspace -scheme XXX clean build OTHER_SWIFT_FLAGS="-Xfrontend -debug-time-function-bodies" | grep '^\d\{3,\}[.]\{1\}'
wudi / new_gist_file_0
Created Oct 11, 2014
View new_gist_file_0
pt:绝对长度单位。点(Point)。(iOS字体)公式如下:pt=(px/96)*72。二,字体间转换1in = 2.54cm = 25.4 mm = 72pt = 6pc
Points Pixels Ems Percent
6pt 8px 0.5em 50%
7pt 9px 0.55em 55%
7.5pt 10px 0.625em 62.5%
8pt 11px 0.7em 70%
9pt 12px 0.75em 75%
10pt 13px 0.8em 80%
lvdaqian / jenkins-email-ext-clangScanReport-template.jelly
Created Apr 10, 2014
a jelly script template for jenkins email-ext plugin. in this template we can publish the report of clangScanBuild plugin by using email template.
View jenkins-email-ext-clangScanReport-template.jelly
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define">
body table, td, th, p, h1, h2 {
font:normal normal
100% Georgia, Serif;
background-color: #ffffff;
View json_parser.js
// This is a coding exercise of implementing a parser. Some minor parsing capabilities are not implemented.
// The algorithm are mainly from Douglas Crockford's ''
function json_parse(str) {
var i = 0
var ch = str[i]
// core function that recursively called to move forward scanning pointers and accept tokens
function next(c) {
if (c) {

Javascript 的测试, 不管在用 jasmine 还是 mocha, 都是很头疼的事情. 但是自从有了 jest, 一口气写7个测试, 腰也不疼了, 头也不疼了.

只需要 3 个理由

在说用 jest 测为什么好之前,我们先来看我们要测的一个例子.

View Web 中文字体应用指南.md

Web 中文字体应用指南

在 Web 上应用字体是一项基本技术,同时也是一门艺术。对于英文字体来说可选择的范围实在是太广泛了,合理的使用它们将会为你的网站增色不少。关于英文字体的使用和搭配技巧,在这里不做赘述,只推荐一套非常好的视频:Fundamentals of Design by CodeSchool



font-family: "宋体";
armcknight /
Last active May 4, 2019
Install Xcode via command line
# Created by Andrew McKnight on 9/24/15
# takes a downloaded .dmg containing Xcode and installs it to a specified location/name, or defaults to /Applications and the DMG's filename
You can’t perform that action at this time.