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
| // | |
| // main.m | |
| // Tst | |
| // | |
| // Created by jianzwang on 2/20/14. | |
| // Copyright (c) 2014 All rights reserved. | |
| // | |
| #import <UIKit/UIKit.h> |
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
| // | |
| // main.m | |
| // Tst | |
| // | |
| // Created by jianzwang on 2/20/14. | |
| // Copyright (c) 2014 | |
| // | |
| #import <UIKit/UIKit.h> |
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
| import sys,array | |
| sumLine = sys.stdin.readline() | |
| def can_put(x,y,data,n): | |
| if data[x][y] == -1: | |
| return False | |
| j = n - 1 | |
| while j >= 0: |
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
| def succ(s:String):String = { | |
| def add(c:Char,step:Char):(Char,Char) = { | |
| if(step != Char.MinValue){ | |
| c match { | |
| case 'z' => ('a','a') | |
| case 'Z' => ('A','A') | |
| case '9' => ('0','1') | |
| case _ => ((c+1).toChar,Char.MinValue) | |
| } | |
| } |
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
| static char overviewKey; | |
| NSArray *array = | |
| [[NSArray alloc] initWithObjects:@"One", @"Two", @"Three", nil]; | |
| // For the purposes of illustration, use initWithFormat: to ensure | |
| // the string can be deallocated |
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
| + (id)sharedManager | |
| { | |
| static dispatch_once_t once; | |
| static id instance; | |
| dispatch_once(&once, ^{instance = self.new;}); | |
| return instance; | |
| } |
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
| package cn.wjz.java.hashMapOrder; | |
| import java.util.HashMap; | |
| import java.util.Map; | |
| import java.util.Map.Entry; | |
| /** | |
| * IN JDK 1.6 & 1.7 IT WILL PRINT | |
| * *** interest = scala | |
| * *** age = 25 | |
| * *** name = jianzhi Wang |
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
| /* | |
| * "{1231,7245}.{asda123,3213,aqqqq}.{zxcasd,kkkk}.123" will to transformed to List(List("1231","7245"),List("asda123","3213","aqqqq"),List("zxcasd","kkkk"),List("123")) | |
| * | |
| */ | |
| object ExprConfigParser extends JavaTokenParsers { | |
| def stringLiter: Parser[String] = """[\w\d]+""".r | |
| def valueTo(obj:Object) :List[String] = { | |
| if(obj.isInstanceOf[String]) | |
| List(obj.asInstanceOf[String]) |
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
| /* | |
| * will do (date,f(date),f(f(date))....... | |
| * | |
| */ | |
| implicit def toStream(date: Date)(implicit f:Function2[Date,Date]): Stream[Date] = { | |
| lazy val stream: Stream[Date] = Stream.cons(date,Stream.cons(f(date),stream.zip(stream.tail).map(p => f(p._2)))) | |
| stream | |
| } |
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
| /** | |
| * This class is used to parse a String and calculate the value of the expression | |
| * assertEquals( 34,ExprParser.parse("1+2+3+4*3+4",(x:Double)=>x+1)) | |
| */ | |
| import scala.util.parsing.combinator._ | |
| object ExprParser extends JavaTokenParsers { | |
| /* | |
| * text is the input String,func is a function effect on every element | |
| */ | |
| def parse(text: String, func: Double => Double ) = { |
NewerOlder