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
// | |
// 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 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 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 BasicDeferredDefaultAttribute: | |
""" | |
实现支持延迟的 deferred_default 方法 | |
在之前的 Video及Post, asset_id 相关的默认属性生成需要用到 pk, pk 是数据库保存之后自动生成的. | |
本 Descriptor 实现逻辑是相当于修改版本的 DeferredAttribute. 如果有 pk 并且对应的值为空值.则调用对应的函数读取值并设置. | |
然后再调用 save. | |
这个方法要求 Model 在 init 中设置对应的值为 models.DEFERRED |
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 -*- | |
from com.android.monkeyrunner import MonkeyRunner as mr,MonkeyDevice as md | |
# Imports the monkeyrunner modules used by this program | |
# usage : $monkeyrunner main.py | |
# 下面的坐标是针对 1080 x 1920 的设备的 如果是其他分辨率的设备请自行调整 | |
__author__ = 'banxi' | |
# Connects to the current device, returning a MonkeyDevice object | |
print("Waiting for connect...") | |
device = mr.waitForConnection() |
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
package main | |
import "fmt" | |
func overlapCount(img1, img2 [][]int) int { | |
count := 0 | |
for i := 0; i < len(img1); i++ { | |
for j := 0; j < len(img1[0]); j++ { | |
if img1[i][j] == 1 && img2[i][j] == 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 | |
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
#import <Foundation/Foundation.h> | |
@import ObjectiveC; | |
void print_class_hierachy(Class cls){ | |
printf("%s\n",class_getName(cls)); | |
Class superclass = class_getSuperclass(cls); | |
int current_level = 0; | |
while (superclass) { | |
current_level++; | |
for (int level = 0; level < current_level;level++) { |
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
__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
#-*- 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): |
NewerOlder