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
| <?php | |
| // Data on which we operate | |
| $tree=[ | |
| '+'=>[ | |
| '*'=>[1,2], | |
| '-'=>[ | |
| '+' => [3,4] | |
| , 5 |
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 java.text.DateFormat | |
| import java.time.LocalDate | |
| import java.util | |
| import java.util.* | |
| /* | |
| Given a list of people with their birth and end years (all between 1900 and 2000), | |
| find the year with the most number of people alive. | |
| See http://qr.ae/RAG2zH | |
| */ |
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
| fun main(args:Array<String>){ | |
| Application.launch(javaClass<Foo>()) | |
| } | |
| fun <T:Any> T.builder(f:T.()->Unit):T{ | |
| this.f() | |
| return this | |
| } | |
| class Foo : Application(){ |
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
| // The bad | |
| isFound boolean = true; | |
| while(isFound) | |
| isFound = false; | |
| for(j int from 1 to array.getSize()) | |
| if (array[j].attribute == "lookupValue") | |
| array.removeElement(j); | |
| isFound = true; | |
| end | |
| end |
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
| gameService.gamelistArray() | |
| .subscribeOn(Schedulers.io()) | |
| .observeOn(AndroidSchedulers.mainThread()) | |
| .subscribe { | |
| gameList -> | |
| adapter=GameListAdapter(gameList.toList().map { it.second },ctx) | |
| } |
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
| -- V1 | |
| [ if x `mod` 3 == 0 then | |
| "Fizz" | |
| else | |
| if x `mod` 5 == 0 then | |
| "Buzz" | |
| else | |
| if x `mod` 15 == 0 then | |
| "FizzBuzz" | |
| else show x |
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 main | |
| import ( | |
| "fmt" | |
| "math/rand" | |
| "math" | |
| "time" | |
| ) |
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 java.io.File | |
| fun main(args: Array<String>) { | |
| args.map { name -> File(name) } | |
| .filter { file -> file.isFile } | |
| .map { file -> Pair(file.name, file.readLines().partition { line -> line.trim().isEmpty() }) } | |
| .forEach { | |
| val name = it.first | |
| val (filledLines,emptyLines) = it.second | |
| println("$name: ${filledLines.size+emptyLines.size} total, ${emptyLines.size} empty") |
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 io.netty.buffer.ByteBufInputStream | |
| import io.vertx.core.Vertx | |
| import io.vertx.ext.web.client.WebClient | |
| import org.jsoup.Jsoup | |
| import org.jsoup.nodes.Element | |
| fun main(args: Array<String>) { | |
| val vertx = Vertx.vertx() | |
| val server = vertx.createHttpServer() | |
| val client = WebClient.create(vertx) |
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 main | |
| import ( | |
| "fmt" | |
| "math/rand" | |
| ) | |
| func Generate(ch chan<- int) { | |
| for i := 2; ; i++ { | |
| ch <- i |
OlderNewer