This file contains 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 net.rubyeye.xmemcached._ | |
object Memcache { | |
def apply(host: String, port: Int): Memcache = { | |
val mc = new Memcache | |
mc.connect(host, port) | |
mc | |
} | |
} |
This file contains 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
//close automatically after use | |
//How to use | |
//import Control.using | |
//using(someDbConnection1, someDbConnection2) {(db1, db2) => | |
// doSomething(db1, db2) | |
//} | |
object Control { | |
type T = {def close(): Unit} |
This file contains 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 jp.sudix.finagle.benchmark | |
import com.twitter.finagle.Service | |
import com.twitter.finagle.http.Http | |
import com.twitter.util.Future | |
import com.twitter.finagle.builder.ServerBuilder | |
import org.jboss.netty.handler.codec.http.{DefaultHttpResponse, HttpVersion, HttpResponseStatus, HttpRequest, HttpResponse} | |
import org.jboss.netty.buffer.ChannelBuffers.copiedBuffer | |
import java.net.{SocketAddress, InetSocketAddress} |
This file contains 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 Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains 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 main | |
import ( | |
"crypto/md5" | |
"errors" | |
"fmt" | |
"io/ioutil" | |
"os" | |
"path/filepath" | |
"sort" |
This file contains 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 main | |
import ( | |
"encoding/json" | |
"fmt" | |
"io/ioutil" | |
"os" | |
"path/filepath" | |
"strings" | |
) |
This file contains 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
/** | |
* UTF-8 to SHIFT_JIS | |
* 全角波線などUTF-8からSHIFT_JIS変換時に文字化けするものを置換 | |
* 参考:http://d.hatena.ne.jp/sardine/20060214/p1 | |
*/ | |
def replaceInvalidChars(s: String): String = | |
s.replaceAll("\u301c", "\uff5e"). //~ (波ダッシュ) | |
replaceAll("\u2212", "\uff0d"). //- (マイナス) | |
replaceAll("\u2016", "\u2225") //∥ (二重垂直線) |
This file contains 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 main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
func DefaultHandler(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprintf(w, "Hello, HTTP!!!") | |
} |
This file contains 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 main | |
import ( | |
"encoding/json" | |
"fmt" | |
"net/http" | |
) | |
type Response map[string]interface{} |
This file contains 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 main | |
import ( | |
"fmt" | |
"net/http" | |
"os" | |
"github.com/codegangsta/cli" | |
) |
OlderNewer