Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| public class SurrogatePair { | |
| public static int convertToUTF16Index(String str, int index) { | |
| int result = 0; | |
| for (int i = 0; i < index && result < str.length(); i++, result++) { | |
| if (result + 1 < str.length() && | |
| Character.isSurrogatePair(str.charAt(result), str.charAt(result + 1))) { | |
| result++; | |
| } | |
| } | |
| return result; |
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
| //: Binary Tree | |
| protocol CollectionTypeConvertible { | |
| typealias T | |
| var array: [T] { get } | |
| } | |
| class Node<T: Comparable> { | |
| let value: T | |
| var left: Node? |
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
| // http://grokbase.com/p/gg/golang-nuts/12a9xcadca/go-nuts-disable-directory-listing-with-http-fileserver | |
| package main | |
| import ( | |
| "net/http" | |
| "os" | |
| ) | |
| type NoListFile struct { |
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 main | |
| import ( | |
| "bytes" | |
| "encoding/gob" | |
| "io" | |
| ) | |
| type Data struct { | |
| A int |
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 main | |
| import ( | |
| "net/http" | |
| "strings" | |
| ) | |
| var CustomTypeMap = map[string]string{ | |
| "text/x-java-source": "text/plain", | |
| } |
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 express = require('express'); | |
| var cgi = require('./cgi'); | |
| app = express(); | |
| var script = __dirname + '/hello.cgi'; | |
| app.get('/', cgi(script, function (req, options) { | |
| options.env.USERNAME = 'Mr. User'; | |
| })); | |
| app.use(function (err, req, res, next) { |
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
| module.exports = function (session) { | |
| var Store = session.Store; | |
| function MyMemoryStore(options) { | |
| Store.call(this, options || {}); | |
| this.debug = options && options.debug; | |
| this.sessions = {}; | |
| } | |
| MyMemoryStore.prototype.__proto__ = Store.prototype; |
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
| import java.io.*; | |
| import java.net.*; | |
| /** | |
| * ちょーかんたんなサーバー。 | |
| */ | |
| public class Server { | |
| /** | |
| * ポート番号。 | |
| */ |
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
| Webプログラミング入門 | |
| 1. ネットワークプログラミングの基礎 | |
| 講義 | |
| - ネットワークの論理構成 | |
| - ホスト名とIPアドレス | |
| - TCP/UDPとポート番号 | |
| - プロトコル、ステートフルとステートレス | |
| 演習 | |
| 簡単なチャットプログラム |