{"action":"reopened","issue":{"url":"https://api.github.com/repos/daisha2001/blog/issues/1","repository_url":"https://api.github.com/repos/daisha2001/blog","labels_url":"https://api.github.com/repos/daisha2001/blog/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/daisha2001/blog/issues/1/comments","events_url":"https://api.github.com/repos/daisha2001/blog/issues/1/events","html_url":"https://github.com/daisha2001/blog/issues/1","id":170587226,"number":1,"title":"代码格式","user":{"login":"daisha2001","id":20965140,"avatar_url":"https://avatars.githubusercontent.com/u/20965140?v=3","gravatar_id":"","url":"https://api.github.com/users/daisha2001","html_url":"https://github.com/daisha2001","followers_url":"https://api.github.com/users/daisha2001/followers","following_url":"https://api.github.com/users/daisha2001/following{/other_user}","gists_url":"https://api.github.com/users/daisha2001/gists{/gist_id}","starred_url":"https://api.github.com/users/daisha2001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daisha2001/subscriptions","organizations_url":"https://api.github.com/users/daisha2001/orgs","repos_url":"https://api.github.com/users/daisha2001/repos","events_url":"https://api.github.com/users/daisha2001/events{/privacy}","received_events_url":"https://api.github.com/users/daisha2001/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-11T07:42:01Z","updated_at":"2016-08-25T09:57:09Z","closed_at":null,"body":"```objectivec\r\n//iOS开发 \r\n```\r\n```swift\r\nvar http = require('http');\r\nhttp.createServer(function (request, response) {\r\n    response.writeHead(200, {'Content-Type': 'text/plain'}); // HTTP Response 头部\r\n    response.end('Hello World\\n'); // 返回数据 “Hello World”\r\n}).listen(8888); // 监听 8888 端口\r\n// 终端打印如下信息\r\nconsole.log('Server running at http://127.0.0.1:8888/');\r\n```\r\n```swift\r\nvar http = require('http');\r\nvar output = require('./string') // 一个第三方模块\r\nhttp.createServer(function (request, response) {\r\n    output.output(response); // 调用第三方模块进行输出\r\n}).listen(8888);\r\n```\r\n```swift\r\nfunction sleep(milliSeconds) {  // 模拟卡顿\r\n    var startTime = new Date().getTime();\r\n    while (new Date().getTime() < startTime + milliSeconds);\r\n}\r\n\r\nfunction outputString(response) {\r\n    sleep(10000);  // 阻塞 10s    \r\n    response.end('Hello World\\n'); // 先执行耗时操作，再输出\r\n}\r\n\r\nexports.output = outputString;\r\n```\r\n```swift\r\nhttp{\r\n    upstream sampleapp {\r\n        // 可选配置项，如 least_conn，ip_hash\r\n        server 127.0.0.1:3000;\r\n        server 127.0.0.1:3001;\r\n        // ... 监听更多端口\r\n    }\r\n    ....\r\n    server{\r\n       listen 80;\r\n       ...\r\n       location / {\r\n          proxy_pass http://sampleapp; // 监听 80 端口，然后转发\r\n       } \r\n    }\r\n```\r\n```swift\r\nvar EventEmitter = require('events');\r\nvar util = require('util');\r\n\r\nfunction MyThing() {\r\n    EventEmitter.call(this);\r\n\r\n    setImmediate(function (self) {\r\n        self.emit('thing1');\r\n    }, this);\r\n    process.nextTick(function (self) {\r\n        self.emit('thing2');\r\n    }, this);\r\n}\r\nutil.inherits(MyThing, EventEmitter);\r\n\r\nvar mt = new MyThing();\r\n\r\nmt.on('thing1', function onThing1() {\r\n    console.log(\"Thing1 emitted\");\r\n});\r\n\r\nmt.on('thing2', function onThing1() {\r\n    console.log(\"Thing2 emitted\");\r\n});\r\n```\r\n```javascript\r\n//javascript\r\n```\r\n\r\n```cpp\r\n//C/C++\r\n```\r\n\r\n```php\r\n//PHP\r\n```\r\n```css\r\n//CSS\r\n```\r\n\r\n```java\r\n```"}}
{"actor":{"display_login":"daisha2001"}}