Skip to content

Instantly share code, notes, and snippets.

View gliyao's full-sized avatar
:octocat:
hungry

Liyao Chen gliyao

:octocat:
hungry
View GitHub Profile
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Setup Data
String[] values = new String[] { "Android", "iPhone", "WindowsMobile",
"Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
"Linux", "OS/2", "Ubuntu", "Windows7", "Max OS X", "Linux",
//
// ViewController.swift
// constrainAnimation
//
// Created by Liyao on 2014/10/30.
// Copyright (c) 2014年 swiftTaipei. All rights reserved.
//
import UIKit
@gliyao
gliyao / animationWtihConstrains
Last active August 29, 2015 14:08
Push animation block in Array. Use recursive method (nextAnimation) to pop each animation block.
//
// LaunchController.swift
// Combo
//
// Created by Liyao on 2014/10/27.
// Copyright (c) 2014年 swiftTaipei. All rights reserved.
//
import UIKit
import AVFoundation
var map = [[Int]]()
var path = [[Int]]()
var level = 3
var stack = [Int]()
func nextSetp(currentStep: Int, currentIndex: Int) {
let value = map[currentStep][currentIndex]
@gliyao
gliyao / rm_git_chache
Created January 29, 2015 02:18
Untrack file without delete.
git rm --cached mylogfile.log
@gliyao
gliyao / LCTextView.h
Created November 15, 2015 03:28
Multiple lines placeholder text view
@interface LCTextView : UITextView
@property (strong, nonatomic) NSString *placeholder;
@property (strong, nonatomic) UIColor *placeholderColor;
- (void)textChangeNotifiaciton:(NSNotification *)n;
@end
@gliyao
gliyao / remove_simulators.sh
Created January 22, 2016 02:38
Remove all simulator in xcode
xcrun simctl list | grep -oh '[A-Z0-9]\{8\}-[A-Z0-9]\{4\}-[A-Z0-9]\{4\}-[A-Z0-9]\{4\}-[A-Z0-9]\{12\}' | xargs -n1 xcrun simctl delete
@gliyao
gliyao / swift_log.swift
Last active December 30, 2016 09:06
swift_log
enum LogTag: String {
case APP = "[APP]"
case DEBUG = "[DEBUG]"
case ERROR = "[ERROR]"
}
fileprivate func debugLog( _ log: @autoclosure () -> Any, _ tags: [LogTag]) {
#if DEBUG
var tagStr = ""
for tag in tags {
@gliyao
gliyao / dummyUITableViewDataSource.m
Last active April 9, 2017 12:43
dummyUITableViewDataSource
@interface DummyUITableViewDataSource : NSObject <UITableViewDataSource>
@end
@implementation DummyUITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 40;
}
@gliyao
gliyao / testTableViewDataSourceNumberOfRowsInSecitonWithDummyClass.m
Created April 9, 2017 12:45
testTableViewDataSourceNumberOfRowsInSecitonWithDummyClass
@interface LCTableViewTests : XCTestCase
@end
@implementation LCTableViewTests
//驗證互動
- (void)testTableViewDataSourceNumberOfRowsInSecitonWithDummyClass
{
//Arrange
DummyUITableViewDataSource *dataSource = [[DummyUITableViewDataSource alloc] init];