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
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
# -*- 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
#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
%define SYSCALL_WRITE 0x2000004 | |
%define SYSCALL_EXIT 0x2000001 | |
global start | |
start: | |
mov rdi, 1 | |
;mov rsi, str | |
lea rsi, [rel str] | |
mov rdx, strlen | |
mov rax, SYSCALL_WRITE |
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
// | |
// CommentView.swift | |
// GuilinLegal | |
// | |
// Created by Haizhen Lee on 15/7/2. | |
// 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
func buildTreeWithPreorder(preorder:[Int],andInorder inorder:[Int]) -> TreeNode?{ | |
if preorder.isEmpty || inorder.isEmpty{ | |
return nil | |
} | |
var branchList = [TreeNode]() | |
let root = TreeNode(val: 0) | |
branchList.append(root) | |
var preorderArray = [[Int]]() |
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 TreeNode{ | |
let val:Int | |
var left:TreeNode? | |
var right:TreeNode? | |
init(val:Int){ | |
self.val = val | |
} | |
} |
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 java.text.SimpleDateFormat; | |
import java.util.*; | |
import java.util.concurrent.*; | |
import java.util.concurrent.atomic.AtomicInteger; | |
import java.util.logging.*; | |
import java.util.logging.Formatter; | |
/** | |
* Created by banxi on 15/6/27. |
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
// | |
// LoadMoreControl.swift | |
// GuilinLegal | |
// | |
// Created by Haizhen Lee on 15/6/19. | |
// Copyright (c) 2015年 banxi1988. All rights reserved. | |
// | |
import UIKit |
NewerOlder