Skip to content

Instantly share code, notes, and snippets.

View serivires's full-sized avatar
๐Ÿ 
Working from home

serivires serivires

๐Ÿ 
Working from home
View GitHub Profile
// my little html string builder
buildHTML = function(tag, html, attrs) {
// you can skip html param
if (typeof(html) != 'string') {
attrs = html;
html = null;
}
var h = '<' + tag;
for (attr in attrs) {
if(attrs[attr] === false) continue;
@chitan
chitan / WsChatServlet.java
Created July 7, 2012 01:44
How to use WebSocket of Tomcat
//This sample is how to use websocket of Tomcat.
package wsapp;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.util.ArrayList;
import org.apache.catalina.websocket.MessageInbound;
import org.apache.catalina.websocket.StreamInbound;
import org.apache.catalina.websocket.WebSocketServlet;
@banterCZ
banterCZ / MyController.java
Created February 11, 2013 12:45
Fix of java.lang.IndexOutOfBoundsException using Spring MVC.
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
/**
* @author banterCZ
*/
@Controller
public class MyController {
lg = log --graph --format=format:'%C(ul cyan)%h%C(reset) |%C(auto)%d%C(reset) %C(white)%ai%C(reset) (%ar)%n'' %C(white)%s%C(reset) %C(bold black)- %an%C(reset)' --all
@jooyunghan
jooyunghan / monad-in-java.md
Last active November 17, 2023 04:54
ํ•œ๊ธ€๋ฒˆ์—ญ - Functor and monad examples in plain Java

Functor and monad examples in plain Java

์ด ๊ธ€์€ ์šฐ๋ฆฌ๊ฐ€ ์“ด ์ฑ…, 'Reactive Programming with RxJava' ์˜ ๋ถ€๋ก์ด์—ˆ๋‹ค. Reactive programming๊ณผ ๊ด€๋ จ์ด ๊นŠ์€ ์ฃผ์ œ๊ธด ํ•˜์ง€๋งŒ ๋ชจ๋‚˜๋“œ๋ฅผ ์†Œ๊ฐœํ•œ๋‹ค๋Š” ๊ฒŒ ์ฑ…๊ณผ ์ฉ ์–ด์šธ๋ฆฌ์ง€๋Š” ์•Š์•˜๋‹ค. ๊ทธ๋ž˜์„œ ๋‚˜๋Š” ๋”ฐ๋กœ ๋ธ”๋กœ๊ทธ์— ์˜ฌ๋ฆฌ๊ธฐ๋กœ ํ–ˆ๋‹ค. ํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ๋‹ค๋ฃจ๋Š” ๋ธ”๋กœ๊ทธ์—์„œ *"๋ฐ˜์€ ๋งž๊ณ  ๋ฐ˜์€ ํ‹€๋ฆด ์ง€ ๋ชจ๋ฅด๋Š” ๋‚˜๋งŒ์˜ ๋ชจ๋‚˜๋“œ ์„ค๋ช…"*์ด๋ž€ ๊ฒƒ์ด ์ƒˆ๋กœ์šด *"Hello World"*๋ผ๋Š” ์ ์„ ๋‚˜๋„ ์ž˜ ์•ˆ๋‹ค. ํ•˜์ง€๋งŒ ์ด ๊ธ€์€ ํŽ‘ํ„ฐ(functor)์™€ ๋ชจ๋‚˜๋“œ(monad)๋ฅผ ์ž๋ฐ” ์ž๋ฃŒ ๊ตฌ์กฐ์™€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ผ๋Š” ๊ฐ๋„์—์„œ ๋ฐ”๋ผ๋ณด๊ณ  ์žˆ์œผ๋ฉฐ, ์ด๋Š” ๊ณต์œ ํ•  ์ •๋„์˜ ๊ฐ€์น˜๋Š” ์žˆ์„๊ฑฐ๋ผ ์ƒ๊ฐํ–ˆ๋‹ค.