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
| type Query = (Int, String) | |
| type Retrieve = Int | |
| type Tag = Query | Retrieve | |
| def print(as: List[Tag]): Unit = | |
| as match | |
| case Nil => () | |
| case h :: tl => | |
| h match | |
| case t: Query => |
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
| // src/main/scala | |
| import japgolly.scalajs.react.* | |
| import japgolly.scalajs.react.vdom.html_<^.* | |
| import org.scalajs.dom.document | |
| object Main: | |
| final class SwitchBackend($: BackendScope[Unit, Boolean]): | |
| def render(s: Boolean) = | |
| val stext = | |
| <.div(^.cls := "content is-small", |
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 japgolly.scalajs.react.* | |
| import japgolly.scalajs.react.vdom.html_<^.* | |
| import net.cluelab.reactbulma.Radio.* | |
| import net.cluelab.reactbulma.Button.Button | |
| import org.scalajs.dom.document | |
| import japgolly.scalajs.react.extra.* | |
| import japgolly.scalajs.react.ReactMonocle.* | |
| import monocle.* |
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
| /* PrismJS 1.29.0 | |
| https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript+java+scala */ | |
| code[class*=language-],pre[class*=language-]{color:#ccc;background:0 0;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#2d2d2d}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}.token.block-comment,.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#999}.token.punctuation{color:#ccc}.token.attr-name,.token.deleted,.token.namespace,.token.tag{color:#e2777a}.token.function-name{color:#6196cc}.token.boolean,.token.function,.token.number{color:#f08d49}.token.class-name,.token.co |
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
| /* PrismJS 1.29.0 | |
| https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript+java+scala */ | |
| var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(e){var n=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,r={},a={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(n){return n instanceof i?new i(n.type,e(n.content),n.alias):Array.isArray(n)?n.map(e):n.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function e(n,t){var r,i;switch(t=t||{},a.util.type(n)){case"Object":if(i=a.util.objId(n),t[i])return t[i];for(var l in r={},t[i]=r,n)n.hasOwnProperty(l)&&(r[l]=e(n[l],t));return r;case"Array":return i=a.util.objId(n),t[i]?t[i]:(r=[],t[i]=r,n.forEach( |
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 distribute[A](select: Seq[A], slot: Int) = { | |
| val total = select.length | |
| // slot에 나누기 위해 선택해야 하는 slot의 최소수 | |
| val tmin = total / slot + (if (total % slot == 0) 0 else 1) | |
| // slot에 나눌수 있는 slot의 최대수 | |
| val tmax = total - slot + 1 | |
| (tmin to tmax).map({ tn => | |
| /* 가능한 순서들을의 조합 | |
| 뒤 slot에서 앞 slot보다 많은 item을 담을 수는 없다 | |
| slot간의 순서는 관계없다 |
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 concurrent.{Future, Promise} | |
| import scala.concurrent.ExecutionContext.Implicits.global | |
| import util.{Random, Try, Success, Failure} | |
| object App { | |
| def main(as:Array[String]) = test | |
| def test = { | |
| // returns future of random Int, with 30% failure rate | |
| def randomFutureWithFailures:Future[Int] = { |
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 javafx.application.Application | |
| import javafx.stage.Stage | |
| import javafx.scene.{Group, Scene} | |
| import javafx.scene.layout.VBox | |
| import javafx.scene.canvas.Canvas | |
| import javafx.scene.paint.Color | |
| import javafx.animation.AnimationTimer | |
| object Perlin2D { | |
| def main(as:Array[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
| import javafx.application.Application | |
| import javafx.stage.Stage | |
| import javafx.scene.{Group, Scene, PerspectiveCamera, Node} | |
| import javafx.scene.canvas.Canvas | |
| import javafx.scene.paint.{Color, PhongMaterial} | |
| import javafx.scene.shape.{Cylinder, Sphere, Box} | |
| import javafx.scene.transform.{Rotate, Scale, Translate} | |
| import javafx.event.EventHandler | |
| import javafx.scene.input.{KeyEvent, MouseEvent, KeyCode} |
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
| #encoding: UTF-8 | |
| require 'Qt4' | |
| class QtGraph < Qt::Widget | |
| STR_INTERVAL = 2 | |
| TICK_SIZE = 3 | |
| slots :next_plot | |
| def initialize(phash = {}, parent = nil) |
NewerOlder