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
//: Play Binary Tree in Playground with Swift 2 | |
import Foundation | |
/*: | |
## Binary Tree Right Side View | |
<https://leetcode.com/problems/binary-tree-right-side-view/> | |
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. |
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
// | |
// IconTextField.swift | |
// ExamTimePickerDemo | |
// | |
// Created by Haizhen Lee on 15/5/29. | |
// Copyright (c) 2015年 banxi1988. All rights reserved. | |
// 以下用到的一些 AutoLayout的自定义封装方法见 | |
// https://gist.github.com/banxi1988/8b07212cadaddd28384f | |
import UIKit |
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
// | |
// GenericDataSource.swift | |
// | |
// Created by Haizhen Lee on 15/5/27. | |
// Copyright (c) 2015年 banxi1988. All rights reserved. | |
// | |
import Foundation | |
class GenericDataSource<T>:SimpleDataSourceBridge{ |
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
// | |
// NumberPickerAdapter.swift | |
// Youjia | |
// | |
// Created by banxi1988 on 15/4/27. | |
// | |
import UIKit | |
class NumberPickerAdapter:NSObject,UIPickerViewDataSource,UIPickerViewDelegate{ |
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
// | |
// UIView+PinAutoLayout.swift | |
// banxi1988 | |
// @LastModified 2015/06/12 | |
// Created by banxi1988 on 15/5/28. | |
// Copyright (c) 2015年 banxi1988. All rights reserved. | |
// | |
import UIKit |
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 WWDC 2014 Session 404 | |
func memoize_v2<T:Hashable,U>(body: ((T) -> U, T) -> U) -> (T) -> U { | |
var memo = [T:U]() | |
var result : ((T) -> U)! | |
result = { x in | |
if let q = memo[x] { return q } | |
let r = body(result,x) | |
memo[x] = r | |
return r | |
} |
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
.method public static getMd5_2(Ljava/lang/String;)Ljava/lang/String; | |
.locals 7 | |
.param p0, "originStr" # Ljava/lang/String; | |
.annotation system Ldalvik/annotation/Throws; | |
value = { | |
Ljava/lang/Exception; | |
} | |
.end annotation | |
.prologue | |
.line 485 |
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 time import sleep,time | |
# Imports the monkeyrunner modules used by this program | |
from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice | |
# Connects to the current device, returning a MonkeyDevice object | |
print("Waiting for connect...") | |
device = MonkeyRunner.waitForConnection() | |
print("Connected") | |
while True: |
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
func uploadThreadImages(selectedImages:[SelectedImage], | |
success:(uploadedImages:[String]) -> Void, | |
error:(resp:UploadImageResponse)-> Void ){ | |
var remindCount = selectedImages.count | |
var uploadedImages:[String] = [] | |
showProgress(label: "正上传图片") | |
let uploadOne = { () -> Void in | |
remindCount-- |
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
class GradientMaskImageView:UIImageView{ | |
let gradientLayer = CAGradientLayer() | |
override init(image: UIImage!) { | |
super.init(image: image) | |
let startColor = UIColor(white: 0, alpha: 0.05) | |
let midColor = UIColor(white: 0, alpha: 0.3) | |
let endColor = UIColor(white: 0, alpha: 0.6) | |
gradientLayer.colors = [ startColor.CGColor, midColor.CGColor, endColor.CGColor ] | |
gradientLayer.frame = frame | |
layer.addSublayer(gradientLayer) |