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:
// | |
// 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:
Verifying myself: My Bitcoin username is +duan. https://onename.io/duan |
import UIKit | |
class DeselectableSegmentedControl: UISegmentedControl { | |
override func touchesEnded(touches: NSSet, withEvent event: UIEvent) { | |
let previouslySelectedIndex = self.selectedSegmentIndex | |
super.touchesEnded(touches, withEvent: event) | |
if previouslySelectedIndex == self.selectedSegmentIndex { | |
self.selectedSegmentIndex = UISegmentedControlNoSegment | |
self.sendActionsForControlEvents(UIControlEvents.ValueChanged) | |
} |
struct Complex<T: FloatLiteralConvertible> { | |
var real: T | |
var imaginary: T | |
} | |
func +(lhs: Complex<Double>, rhs: Complex<Double>) -> Complex<Double> { | |
return Complex<Double>(real: lhs.real + rhs.real, imaginary: lhs.imaginary + rhs.imaginary) | |
} | |
func -(lhs: Complex<Double>, rhs: Complex<Double>) -> Complex<Double> { |
// Swift 2 Beta 2 to the rescue! | |
protocol A { | |
var b: B { get set } | |
} | |
protocol B { | |
func handle() | |
} | |
extension B { |
SDKPATH = $(shell xcrun --show-sdk-path --sdk macosx) | |
CBRIDGEHEADER = bridge.h | |
TARGETS := cat | |
.PHONY : all $(TARGETS) | |
all: $(TARGETS) | |
$(TARGETS): | |
swiftc -sdk $(SDKPATH) $@.swift -import-objc-header $(CBRIDGEHEADER) -o $@ |
#!/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'; | |
} |