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 org.eclipse.collections.api.list.primitive.MutableIntList; | |
| import org.eclipse.collections.impl.factory.primitive.IntIntMaps; | |
| import org.eclipse.collections.impl.factory.primitive.IntLists; | |
| import java.util.Random; | |
| import java.util.function.Supplier; | |
| import java.util.stream.IntStream; | |
| public class Main { |
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
| object Simirality { | |
| def j[T](a:Set[T], b:Set[T]):Double = (a intersect b).size.toDouble / (a | b).size | |
| } |
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
| $ echo -e "10.11.3" | sed 's/^\(.*\)\.\(.*\)/\1/' | |
| 10.11 |
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
| object WordCounter { | |
| def countWords(line: List[String]): Map[String, Int] = | |
| line.flatMap(x=>x.split(" ")).groupBy(x => x).mapValues(x=>x.length) | |
| } |
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 range(a: Int,b: Int, l:List[Int] = List.empty[Int]):List[Int] = { | |
| if (a >= b) l.reverse | |
| else range((a+1), b, a ::l) | |
| } |
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 scala.annotation.tailrec | |
| import scala.util.Random | |
| object ZDK { | |
| val Z = "Z" | |
| val D = "D" | |
| val K = "K" | |
| @tailrec | |
| def zundoko(zd: List[String] = Nil): List[String] = zd match { | |
| case D :: Z :: Z :: Z :: Z :: _ => zd.reverse |
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 handlers | |
| import com.github.masahitojp.botan.Robot | |
| import com.github.masahitojp.botan.handler.BotanMessageHandlers | |
| import com.github.masahitojp.botan.message.BotanMessage | |
| class PingHandlers : BotanMessageHandlers { | |
| override fun register(robot: Robot?) { | |
| robot?.respond( | |
| "ping\\z", |
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 handlers.alias; | |
| import com.github.masahitojp.botan.Robot; | |
| import com.github.masahitojp.botan.handler.BotanMessageHandlers; | |
| import com.github.masahitojp.botan.message.BotanMessageSimple; | |
| import org.slf4j.Marker; | |
| import org.slf4j.MarkerFactory; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; |
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
| @namespace url(http://www.w3.org/1999/xhtml); | |
| @-moz-document url("https://twitter.com/") { | |
| .HeartAnimationContainer { | |
| visibility: hidden; | |
| } | |
| .HeartAnimationContainer:after { | |
| content: '🍣'; | |
| visibility: visible; | |
| display: block; |
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
| $ crystal version | |
| Crystal 0.9.1 [b3b1223] (Fri Oct 30 03:48:35 UTC 2015) | |
| $ ruby -v | |
| ruby 2.1.2p95 (2014-05-08) [x86_64-linux-gnu] | |
| $ crystal build parindrome.cr | |
| $ time ./parindrome | |
| real 0m0.548s | |
| user 0m0.560s |