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
<html> | |
<head> | |
<meta charset="utf-8"> | |
</head> | |
<body> | |
<style> | |
@font-face{ | |
font-family: 'Saitamaar'; | |
src: local('Saitamaar'), | |
url('http://keage.sakura.ne.jp/fonts/Saitamaar.eot?') format('eot'), |
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
javascript:speechSynthesis.cancel();if(typeof%20_speechslackobserver!=="undefined")_speechslackobserver.disconnect();_speechslackobserver=new%20MutationObserver(rs=>{r=rs[rs.length-1];if(r.nextSibling)return;r.addedNodes.forEach(n=>{if(n.ariaExpanded!=="false")return;m=/:\d\d(.+)/gs.exec(n.textContent);if(m){speechSynthesis.speak(new%20SpeechSynthesisUtterance(m[1]))}})}).observe(document.querySelectorAll(".c-virtual_list__scroll_container")[1],{subtree:true,childList:true}); |
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
const arr = [ ... ]; // なにか配列 | |
const pred = e => ...; // なにか述語 | |
const {result} = arr.reduce((acc, cur) => { | |
if (acc.finished) { return acc; } | |
acc.finished = !pred(cur); | |
if (acc.finished) { return acc; } | |
acc.result.push(cur); | |
return acc; | |
}, {result: [], finished: false}); |
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
# | |
# ババ抜き | |
# | |
# | |
# カードが引かれたかどうかを表す配列。 | |
# 1 なら引かれていない。0 なら引かれている。 | |
my @card = (1, 1, 1, 1, 1, 1); | |
# |
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
git ls-files | xargs -L 1 git blame --before=1months -- | grep TODO |
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
scala> val str = "ab$(cd$(ef)gh)ij" | |
str: String = ab$(cd$(ef)gh)ij | |
scala> new scala.util.matching.Regex("""\)([^\)]*?)\(\$""").findFirstIn(str.reverse).get.reverse | |
res0: String = $(ef) |
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
scala> def primes(s: Stream[Int] = Stream.from(2)): Stream[Int] = s.head #:: primes(s.tail.filter(_ % s.head != 0)) | |
primes: (s: Stream[Int])Stream[Int] | |
scala> primes().foreach(println) | |
2 | |
3 | |
5 | |
...省略... | |
33827 | |
33829 |
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 QRA extends App { | |
val src = new java.util.Scanner(System.in) | |
val t = src.nextInt() | |
(1 to t).foreach { t => | |
val n = src.nextInt() | |
val answer = n match { | |
case 0 => "INSOMNIA" | |
case n => | |
def sheeps(s: Int, m: Set[Char]): Stream[(Int, Set[Char])] = | |
(s -> m) #:: sheeps(s + n, m ++ (s + n).toString) |
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
$ scala | |
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_74). | |
Type in expressions for evaluation. Or try :help. | |
scala> val s = (1 to 10).toStream | |
s: scala.collection.immutable.Stream[Int] = Stream(1, ?) | |
scala> s.map(s => {println(" " + s); s}).filter(_ % 2 == 0).foreach(println) | |
1 | |
2 | |
2 |
NewerOlder