Skip to content

Instantly share code, notes, and snippets.

const e=["sample"],o=()=>{const t=document.querySelectorAll(".js-chirp-container");0!==t.length?t.forEach((o=>{new MutationObserver((o=>{o.forEach((o=>{Array.from(o.addedNodes).forEach((o=>{const{name:t,text:r}=extractText(o);(o=>e.some((e=>o.includes(e))))(r)&&(console.log(`removed ${r} by ${t}}`),o.parentNode.removeChild(o))}))}))})).observe(o,{childList:!0})})):setTimeout(o,500)};o();
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.hyperapp={})}(this,function(e){"use strict";e.h=function(e,n){for(var t=[],r=[],o=arguments.length;2<o--;)t.push(arguments[o]);for(;t.length;){var l=t.pop();if(l&&l.pop)for(o=l.length;o--;)t.push(l[o]);else null!=l&&!0!==l&&!1!==l&&r.push(l)}return"function"==typeof e?e(n||{},r):{nodeName:e,attributes:n||{},children:r,key:n&&n.key}},e.app=function(e,n,t,r){var o,l=[].map,u=r&&r.children[0]||null,i=u&&function n(e){return{nodeName:e.nodeName.toLowerCase(),attributes:{},children:l.call(e.childNodes,function(e){return 3===e.nodeType?e.nodeValue:n(e)})}}(u),f=[],m=!0,a=v(e),c=function e(r,o,l){for(var n in l)"function"==typeof l[n]?function(e,t){l[e]=function(e){var n=t(e);return"function"==typeof n&&(n=n(h(r,a),l)),n&&n!==(o=h(r,a))&&!n.then&&d(a=p(r,v(o,n),a)),n}}(n,l[n]):e(r.concat(n),o[n]=v(o[n]),l[n]=v(l[n]));return l}([],a,v(n));return d(),c;function g(e){return"func
sealed abstract class ActorType {
override def toString: String = this.getClass.getName.init
}
case object Application extends ActorType
case object Group extends ActorType
case object Organization extends ActorType
case object Person extends ActorType
case object Service extends ActorType
object unpack {
def main(args: Array[String]): Unit = {
val tuple = (1, 2)
println(plus(1, 2)) // 3
println((plus _).tupled(tuple)) // 3
}
def plus(a: Int, b: Int): Int = a + b
}
args = [1, 2]
def plus(a, b):
return a + b
print(plus(1, 2)) # 3
print(plus(*args)) # 3
sudo docker run -it --rm -p 9000:9000 \
-v=$(pwd):/root \
-e VIRTUAL_HOST=chao.example.com \
-e LETSENCRYPT_HOST=chao.example.com \
-e LETSENCRYPT_EMAIL=chao@example.com \
-e VIRTUAL_PORT=9000 \
--net friends_link \
hseeberger/scala-sbt:8u151-2.12.4-1.1.0 \
sbt run
object app extends App {
val l = List(1, 1, 1, 2, 2, 3, 4, 5, 5)
val res = S09(l)
println(res)
def S09[A](list: List[A]): List[Any] = {
def together(num: Int, head: A, tail: List[A]): List[Any] = {
println(num, head, tail)
tail match {
case x :: xs if x == head => together(num + 1, head, xs)
object chao extends App{
implicit class RichInt(arg: Int) {
def hosiinize: String = arg.toString + "兆円欲しい!"
}
println(3.hosiinize) // 3兆円欲しい!
println(5000.hosiinize) // 5000兆円欲しい!
}
@chao7150
chao7150 / CannotImplicitConversion.scala
Created May 13, 2019 06:01
CannotImplicitConversion.scala
class Yakisoba(val taste: String)
object main extends App {
// YakisobaからBooleanへのImplicit Conversion
implicit def yakisobaToBoolean[A](yakisoba: A)(implicit f: A => Yakisoba): Boolean = yakisoba.taste == "sauce"
// BooleanからIntへのImpliit Conversion
implicit def booleanToInt[B](arg: B)(implicit f: B => Boolean): Int = if (arg) 1 else 0
// ひとつひとつは機能する
class MyClass:
def getX(self):
return self
myclass = MyClass()
# クラスから呼び出すと想定通り動く
print(myclass.getX())
# <__main__.MyClass object at 0x7f2a12223588>