A basic HTML bar chart with log scale.
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
public static void main(String[] args) { | |
int iterations = 1000000; | |
Object[] items = {"foo", 23, true}; | |
int size = items.length; | |
Object[] absoluteResult = new Object[iterations*size]; | |
long before = System.currentTimeMillis(); | |
for (int i=0; i < iterations; i++) { | |
for (int j=0 ; j< size; j++) { | |
absoluteResult[3*i+j]=foo(items[j]); | |
} |
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 info.daviot.lceb | |
import scala.util.parsing.combinator._ | |
sealed trait Expr { def eval: Int } | |
case class Number(value: Int) extends Expr { | |
val eval = value | |
} | |
case class Prod(left: Expr, right: Expr) extends Expr { | |
def eval = left.eval * right.eval | |
} |
Open with scala-js-fiddle for a demo
Implementation of Hearthstone mulligans with scala-js-fiddle.
Examples
- There are 2 important cards in a deck, but you don't keep them in the mulligan phase (let's say 2 Doomguards in zoo). What is the probability to have at least one in hand at a given turn, if the player did not start the game ?
- You think an opponent plays one Sylvanas. You started the game. What is the probability he has drawn it, assuming he does not keep it in the mulligans ?
- You play 4 acceleration (Innervate, Wild Growth) cards. By mulliganing everything except those, what is the probability to have exactly one in starting hand ?
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
//CodinGame - Bender | |
object Solution extends App { | |
val n = readInt | |
val exterior = -1 -> new Room(-1, 0, -1, -1) | |
val roomsRead = for { | |
i <- (0 until n).toList | |
Array(id, value, next1, next2) = readLine split " " | |
} yield id.toInt -> Room(id.toInt, value.toInt, if (next1 == "E") -1 else next1.toInt, if (next2 == "E") -1 else next2.toInt) | |
val rooms = (exterior :: roomsRead).toMap |
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
<!DOCTYPE html> | |
<html> | |
<title>Agile Catalog</title> | |
<xmp theme="cerulean" style="display:none;"> | |
This catalog references books and videos on agile. | |
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 off | |
SET st2Path=C:\Program Files\Sublime Text 2\sublime_text.exe | |
rem add it for all file types | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f | |
rem add it for folders | |
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f |
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
// See http://www.lihaoyi.com/hands-on-scala-js/#Scalatags | |
import org.scalajs.dom | |
import dom.html | |
import scalajs.js.annotation.JSExport | |
object ScalaJSExample extends js.JSApp { | |
val document = js.Dynamic.global.document | |
def 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
import util._ | |
import dom.ext._ | |
import scala.scalajs.concurrent.JSExecutionContext.Implicits.runNow | |
object ScalaJSExample extends js.JSApp{ | |
def main(): Unit = { | |
val url = | |
"http://jsonplaceholder.typicode.com/posts/1" | |
val f=Ajax.get(url) | |
f.onComplete{ |
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
<input type="submit" onClick="plusOne()" value="+1"/> | |
<input type="submit" onClick="minusOne()" value="-1"/> | |
<input type="submit" onClick="reset()" value="reset"/> | |
<table width="200" border="0" align="center"> | |
<tbody style="display:flex"><tr> | |
<td><img src="on.png" name="C1" width="50" height="50" id="C1" alt=""></td> | |
<td><img src="on.png" name="C2" width="50" height="50" id="C2" alt=""></td> | |
<td><img src="on.png" name="C3" width="50" height="50" id="C3" alt=""></td> | |
<td><img src="off.png" name="C4" width="50" height="50" id="C4" alt=""></td> | |
</tr> |
OlderNewer