资源简介
nodejs 基于socket.io实现聊天室

代码片段和文件信息
#!/usr/bin/env python
import re
import json
# http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
# http://stackoverflow.com/a/13436167/96656
def unisymbol(codePoint):
if codePoint >= 0x0000 and codePoint <= 0xFFFF:
return unichr(codePoint)
elif codePoint >= 0x010000 and codePoint <= 0x10FFFF:
highSurrogate = int((codePoint - 0x10000) / 0x400) + 0xD800
lowSurrogate = int((codePoint - 0x10000) % 0x400) + 0xDC00
return unichr(highSurrogate) + unichr(lowSurrogate)
else:
return ‘Error‘
def hexify(codePoint):
return ‘U+‘ + hex(codePoint)[2:].upper().zfill(6)
def writeFile(filename contents):
print filename
with open(filename ‘w‘) as f:
f.write(contents.strip() + ‘\n‘)
data = []
for codePoint in range(0x000000 0x10FFFF + 1):
symbol = unisymbol(codePoint)
# http://stackoverflow.com/a/17199950/96656
bytes = symbol.encode(‘utf8‘).decode(‘latin1‘)
data.append({
‘codePoint‘: codePoint
‘decoded‘: symbol
‘encoded‘: bytes
});
jsonData = json.dumps(data sort_keys=False indent=2 separators=(‘‘ ‘: ‘))
# Use tabs instead of double spaces for indentation
jsonData = jsonData.replace(‘ ‘ ‘\t‘)
# Escape hexadecimal digits in escape sequences
jsonData = re.sub(
r‘\\u([a-fA-F0-9]{4})‘
lambda match: r‘\u{}‘.format(match.group(1).upper())
jsonData
)
writeFile(‘data.json‘ jsonData)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6814 2015-08-04 15:09 chat\app.js
文件 9140 2015-08-03 17:54 chat\node_modules\body-parser\HISTORY.md
文件 2649 2015-08-03 17:54 chat\node_modules\body-parser\index.js
文件 3512 2015-08-03 17:54 chat\node_modules\body-parser\lib\read.js
文件 3608 2015-08-03 17:54 chat\node_modules\body-parser\lib\types\json.js
文件 1847 2015-08-03 17:54 chat\node_modules\body-parser\lib\types\raw.js
文件 2238 2015-08-03 17:54 chat\node_modules\body-parser\lib\types\text.js
文件 5414 2015-08-03 17:54 chat\node_modules\body-parser\lib\types\urlencoded.js
文件 1172 2015-08-03 17:54 chat\node_modules\body-parser\LICENSE
文件 899 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\bytes\History.md
文件 2626 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\bytes\index.js
文件 1680 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\bytes\package.json
文件 2070 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\bytes\Readme.md
文件 196 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\content-type\HISTORY.md
文件 4678 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\content-type\index.js
文件 1089 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\content-type\LICENSE
文件 1767 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\content-type\package.json
文件 2796 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\content-type\README.md
文件 23 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\debug\.jshintrc
文件 42 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\debug\.npmignore
文件 480 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\debug\bower.json
文件 3763 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\debug\browser.js
文件 309 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\debug\component.json
文件 4096 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\debug\debug.js
文件 5611 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\debug\History.md
文件 715 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\debug\Makefile
文件 4758 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\debug\node.js
文件 53 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\debug\node_modules\ms\.npmignore
文件 1307 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\debug\node_modules\ms\History.md
文件 2332 2015-08-03 17:54 chat\node_modules\body-parser\node_modules\debug\node_modules\ms\index.js
............此处省略1636个文件信息
相关资源
- 通信软件的具体实例──基于Socket的
- 用VC 编写的仿QQ聊天室程序源代码
- 基于CSocket的多人聊天室
- mfc聊天室
- irc聊天室
- 前端Vue+Node+MongoDB高级全栈开发
- 易语言服务器源码易语言简易聊天室
- SignalR net版本的在线聊天室
- linux网络聊天室
- 基于ajax的web聊天室
- FLASH局域网免服务器P2P聊天室源码(
- 易语言聊天室客户源码易语言聊天室
- 通过NodeJS中的http.get() 和 http.requ
- Grunt 离线安装包
- nodejs in action第二版(nodejs实战第二版
- Automating with Node.js.pdf
- 基于QTsocket的局域网聊天室
- Nodejs实战第二版
- Node.js-支付宝api的nodejs实现代码
- Node.js-使用nodejs的微服务
- ActiveMQ实战——实现一个简易版的聊天
- 局域网多人语音聊天
- node-v4.5.0-x64.msi
- Socket实现一对一聊天
- nodejs-web demo增删改查
- QT制作的QQ聊天室
- 基于socket的简易多人聊天室
- 即时双人联机对战扫雷小游戏
- 百度语音识别node服务器版demo
- 基于nodejs实现的串口通信
评论
共有 条评论