I hereby claim:
- I am dduan on github.
- I am duan (https://keybase.io/duan) on keybase.
- I have a public key whose fingerprint is 2D75 873D D420 18FB 5B6B 72C5 4876 9046 F6CC 539C
To claim this, I am signing this object:
# Authored by [email protected] as found in the following link: | |
# http://www.mail-archive.com/[email protected]/msg18928.html | |
import sys | |
from PyQt4 import QtCore | |
from PyQt4 import QtGui | |
from PyQt4.QtCore import QObject | |
from PyQt4.QtCore import QUrl | |
from PyQt4.QtCore import QSizeF |
#!/usr/bin/python | |
''' Runs tests defined in package 'tests' ''' | |
from unittest import defaultTestLoader, TextTestRunner | |
TextTestRunner().run(defaultTestLoader.discover('tests', pattern='*.py')) |
// from http://www.php.net/manual/en/language.types.string.php | |
<?php | |
// Show all errors. | |
error_reporting(E_ALL); | |
class beers { | |
const softdrink = 'rootbeer'; | |
public static $ale = 'ipa'; | |
} |
@import 'sencha-touch/base'; | |
@import 'sencha-touch/base/all'; | |
@import 'sencha-touch/default'; | |
@import 'sencha-touch/default/all'; | |
// You may remove any of the following modules that you | |
// do not use in order to create a smaller css file. | |
@import 'sencha-touch/default/panel'; | |
@import 'sencha-touch/default/button'; | |
@import 'sencha-touch/default/sheet'; |
SASS_PATH = resources/sass | |
COFFEE_PATH = app | |
all: sass coffee | |
develop: watch server | |
server: | |
python3 -m http.server |
// | |
// UIColor+SingleValue.h | |
// | |
// Created by Daniel Duan on 1/26/14. | |
// BSD License | |
// | |
#import <UIKit/UIKit.h> | |
@interface UIColor (SingleValue) | |
- (UIColor *)initWithInteger: (int32_t)integer; |
I hereby claim:
To claim this, I am signing this object:
- (NSString *)guessMIMETypeFromFileName: (NSString *)fileName { | |
// Borrowed from http://stackoverflow.com/questions/2439020/wheres-the-iphone-mime-type-database | |
CFStringRef UTI = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)[fileName pathExtension], NULL); | |
CFStringRef MIMEType = UTTypeCopyPreferredTagWithClass(UTI, kUTTagClassMIMEType); | |
CFRelease(UTI); | |
if (!MIMEType) { | |
return @"application/octet-stream"; | |
} | |
return (__bridge NSString *)(MIMEType); | |
} |
Verifying myself: My Bitcoin username is +duan. https://onename.io/duan |
extension NSAttributedString { | |
func replaceHTMLTag(tag: String, withAttributes attributes: [String: AnyObject]) -> NSAttributedString { | |
let openTag = "<\(tag)>" | |
let closeTag = "</\(tag)>" | |
let resultingText: NSMutableAttributedString = self.mutableCopy() as NSMutableAttributedString | |
while true { | |
let plainString = resultingText.string as NSString | |
let openTagRange = plainString.rangeOfString(openTag) | |
if openTagRange.length == 0 { |