This file contains 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 -*- | |
class Address(object): | |
def __init__(self, name): | |
self.name = name | |
def __eq__(self, other): | |
return self.name == other.name | |
def __ne__(self, other): |
This file contains 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
__author__ = 'Alec' | |
import threading | |
import time | |
import thread | |
import gevent | |
cids = [] |
This file contains 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
def is_empty(value): | |
"""Check whether the given value should be considered "empty".""" | |
return value is None or value == '' or ( | |
isinstance(value, (list, tuple, dict)) and not value) | |
def int_to_python(value,min=None,max=None,empty=False,default=0,error=None): | |
""" | |
:param value: 待验证的值 | |
:param min: 值的最小取值范围 | |
:param max: 最大取值范围 |
This file contains 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
import UIKit | |
class IconLabel:UIView{ | |
var iconPadding: CGFloat = 6 { | |
didSet{ | |
updateConstraintsIfNeeded() | |
} | |
} | |
var text :String?{ |
This file contains 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
import UIKit | |
class CircleImageView: UIImageView { | |
var borderWidth:CGFloat=6.0{ | |
didSet{ | |
updateBorderStyle() | |
} | |
} | |
var borderColor:UIColor=UIColor(white: 160, alpha: 0.5){ |
This file contains 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
// Playground - noun: a place where people can play | |
import UIKit | |
class SampleCalendarEvent:NSObject{ | |
let title = "Event\(random()%10000)" | |
let day = random()%7 | |
let startHour = random()%20 | |
let durationInHours = random()%5 + 1 | |
This file contains 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
// Playground - noun: a place where people can play | |
import UIKit | |
extension UIColor{ | |
convenience init(hex:Int){ | |
let red = CGFloat((hex >> 16) & 0xff) / 255.0 | |
let green = CGFloat((hex >> 8) & 0xff) / 255.0 | |
let blue = CGFloat( hex & 0xff) / 255.0 | |
self.init(red:red,green:green,blue:blue,alpha:1) |
This file contains 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 CommentView:UICollectionViewCell{ | |
let nameView = UILabel() | |
let textLabel = UILabel() | |
class var identifier:String{ | |
return "CommentView" | |
} | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
setup() |
This file contains 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 TextCommentView:UILabel{ | |
var name :String = ""{ | |
didSet{ | |
updateText() | |
} | |
} | |
var comment:String = ""{ | |
didSet{ | |
updateText() |
This file contains 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 CommentView:UIControl{ | |
let nameView = UILabel() | |
let textLabel = UILabel() | |
let innerSpace:CGFloat = 4 | |
var insets:UIEdgeInsets = UIEdgeInsets(top: 8, left: 8, bottom: 8, right: 8){ | |
didSet{ | |
invalidateIntrinsicContentSize() | |
} | |
} | |
class var identifier:String{ |
OlderNewer