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 quickstart.action | |
| import scala.concurrent._ | |
| import io.netty.channel.{ChannelFuture, ChannelFutureListener} | |
| import xitrum.{Action, ActorAction, FutureAction, Config} | |
| import xitrum.annotation.GET | |
| import xitrum.etag.NotModified |
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
| let success = (value) => { | |
| console.log('success', value) | |
| } | |
| let fail = (value) => { | |
| console.log('fail', value) | |
| } | |
| let action = (name) => { | |
| return new Promise((resolve, reject) => { |
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
| 'use strict'; | |
| import React from 'react/addons'; | |
| const IS_FORM_SUPPORTED = (() => {return window.FormData !== undefined; })(); | |
| const UPLOAD_ACTION = '/api/fileupload'; | |
| const styles = { | |
| label: { | |
| 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
| function* idMaker(prefix){ | |
| let idx = 0; | |
| while(true){ | |
| yield `${prefix}_${idx++}`; | |
| } | |
| } | |
| let users = idMaker("user"); | |
| console.log(users.next()) // {"value":"user_0","done":false} | |
| console.log(users.next()) // {"value":"user_1","done":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
| scala> var s: Option[String] = None | |
| scala> s = None | |
| scala> s.foreach {_ => | |
| | s = Some("some") | |
| | } | |
| scala> s | |
| // => ??? |
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 quickstart.action | |
| import java.util.concurrent.TimeUnit | |
| import scala.util.Random | |
| import io.netty.channel.{ChannelFuture, ChannelFutureListener} | |
| import io.netty.util.{HashedWheelTimer, TimerTask, Timeout} | |
| import xitrum.{Action, SkipCsrfCheck} | |
| import xitrum.annotation.GET |
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 > for (i <- 0 to 17){ | |
| | val token = scala.util.Random.alphanumeric.take(29).map{s => "%02x".format(s.toByte)}.mkString("") + "%06x".format(i) | |
| | println(token) | |
| | } | |
| 39514f6965667341367934535a5272513766653353444c565557736942000000 | |
| 3337534c71664c674a7543657a51427242417376446173455038667044000001 | |
| 414f696a744c714866376749683551393772794b663074543561687063000002 | |
| 536e4c5a4c5a69784571757672394e537564446c4f31786a5357594f61000003 | |
| 65335a46306932495a437351513974514f4875323932516f52396c6e79000004 |
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 rev-parse --short HEAD |
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
| var genGen = function(arr, loop){ | |
| return (function* (){ | |
| var idx = 0; | |
| var len = arr.length | |
| while(true){ | |
| if (len === idx && loop) idx = 0; | |
| yield arr[idx++]; | |
| } | |
| })(); | |
| }; |
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
| # https://docs.oracle.com/cd/E19416-01/820-5959/6nhaosbus/index.html | |
| # http://wiki.eclipse.org/Jetty/Howto/Configure_SSL | |
| openssl pkcs12 -export \ | |
| -in ./my.crt \ | |
| -inkey ./my.key \ | |
| -certfile intermediate.crt \ | |
| -out ./keystore.pkcs12 \ | |
| -name "xitrum" |