| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f8ca6b3 commit 8c85340
38 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,7 +28,7 @@ http.createServer(function (req, res) { | |||
| 28 | 28 | if (command == "bytes") { | |
| 29 | 29 | var n = parseInt(arg, 10) | |
| 30 | 30 | if (n <= 0) | |
| 31 | - throw "bytes called with n <= 0" | ||
| 31 | + throw "bytes called with n <= 0" | ||
| 32 | 32 | if (stored[n] === undefined) { | |
| 33 | 33 | console.log("create stored[n]"); | |
| 34 | 34 | stored[n] = ""; | |
@@ -64,7 +64,7 @@ http.createServer(function (req, res) { | |||
| 64 | 64 | ||
| 65 | 65 | var content_length = body.length.toString(); | |
| 66 | 66 | ||
| 67 | - res.writeHead( status | ||
| 67 | + res.writeHead( status | ||
| 68 | 68 | , { "Content-Type": "text/plain" | |
| 69 | 69 | , "Content-Length": content_length | |
| 70 | 70 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,45 +7,45 @@ def fib(n) | |||
| 7 | 7 | ||
| 8 | 8 | def wait(seconds) | |
| 9 | 9 | n = (seconds / 0.01).to_i | |
| 10 | - n.times do | ||
| 10 | + n.times do | ||
| 11 | 11 | sleep(0.01) | |
| 12 | - #File.read(DIR + '/yahoo.html') | ||
| 12 | + #File.read(DIR + '/yahoo.html') | ||
| 13 | 13 | end | |
| 14 | 14 | end | |
| 15 | 15 | ||
| 16 | 16 | class SimpleApp | |
| 17 | 17 | @@responses = {} | |
| 18 | - | ||
| 18 | + | ||
| 19 | 19 | def initialize | |
| 20 | 20 | @count = 0 | |
| 21 | 21 | end | |
| 22 | - | ||
| 22 | + | ||
| 23 | 23 | def deferred?(env) | |
| 24 | 24 | false | |
| 25 | 25 | end | |
| 26 | - | ||
| 26 | + | ||
| 27 | 27 | def call(env) | |
| 28 | 28 | path = env['PATH_INFO'] || env['REQUEST_URI'] | |
| 29 | 29 | commands = path.split('/') | |
| 30 | - | ||
| 30 | + | ||
| 31 | 31 | @count += 1 | |
| 32 | 32 | if commands.include?('periodical_activity') and @count % 10 != 1 | |
| 33 | 33 | return [200, {'Content-Type'=>'text/plain'}, "quick response!\r\n"] | |
| 34 | 34 | end | |
| 35 | - | ||
| 35 | + | ||
| 36 | 36 | if commands.include?('fibonacci') | |
| 37 | 37 | n = commands.last.to_i | |
| 38 | 38 | raise "fibonacci called with n <= 0" if n <= 0 | |
| 39 | 39 | body = (1..n).to_a.map { |i| fib(i).to_s }.join(' ') | |
| 40 | 40 | status = 200 | |
| 41 | - | ||
| 41 | + | ||
| 42 | 42 | elsif commands.include?('wait') | |
| 43 | 43 | n = commands.last.to_f | |
| 44 | 44 | raise "wait called with n <= 0" if n <= 0 | |
| 45 | 45 | wait(n) | |
| 46 | 46 | body = "waited about #{n} seconds" | |
| 47 | 47 | status = 200 | |
| 48 | - | ||
| 48 | + | ||
| 49 | 49 | elsif commands.include?('bytes') | |
| 50 | 50 | n = commands.last.to_i | |
| 51 | 51 | raise "bytes called with n <= 0" if n <= 0 | |
@@ -56,17 +56,17 @@ def call(env) | |||
| 56 | 56 | n = 20 * 1024; | |
| 57 | 57 | body = @@responses[n] || "C"*n | |
| 58 | 58 | status = 200 | |
| 59 | - | ||
| 59 | + | ||
| 60 | 60 | elsif commands.include?('test_post_length') | |
| 61 | 61 | input_body = "" | |
| 62 | 62 | while chunk = env['rack.input'].read(512) | |
| 63 | - input_body << chunk | ||
| 63 | + input_body << chunk | ||
| 64 | 64 | end | |
| 65 | 65 | if env['CONTENT_LENGTH'].to_i == input_body.length | |
| 66 | 66 | body = "Content-Length matches input length" | |
| 67 | 67 | status = 200 | |
| 68 | 68 | else | |
| 69 | - body = "Content-Length doesn't matches input length! | ||
| 69 | + body = "Content-Length doesn't matches input length! | ||
| 70 | 70 | content_length = #{env['CONTENT_LENGTH'].to_i} | |
| 71 | 71 | input_body.length = #{input_body.length}" | |
| 72 | 72 | status = 500 | |
@@ -75,7 +75,7 @@ def call(env) | |||
| 75 | 75 | status = 404 | |
| 76 | 76 | body = "Undefined url" | |
| 77 | 77 | end | |
| 78 | - | ||
| 78 | + | ||
| 79 | 79 | body += "\r\n" | |
| 80 | 80 | headers = {'Content-Type' => 'text/plain', 'Content-Length' => body.length.to_s } | |
| 81 | 81 | [status, headers, [body]] | |
@@ -90,6 +90,6 @@ def call(env) | |||
| 90 | 90 | require 'thin' | |
| 91 | 91 | require 'ebb' | |
| 92 | 92 | # Rack::Handler::Mongrel.run(SimpleApp.new, :Port => 8000) | |
| 93 | - Thin::Server.start("0.0.0.0", 8000, SimpleApp.new) | ||
| 93 | + Thin::Server.start("0.0.0.0", 8000, SimpleApp.new) | ||
| 94 | 94 | # Ebb::start_server(SimpleApp.new, :port => 8000) | |
| 95 | 95 | end | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3596,7 +3596,7 @@ try { | |||
| 3596 | 3596 | var Verify = binding.Verify; | |
| 3597 | 3597 | var crypto = true; | |
| 3598 | 3598 | } catch (e) { | |
| 3599 | - | ||
| 3599 | + | ||
| 3600 | 3600 | var crypto = false; | |
| 3601 | 3601 | } | |
| 3602 | 3602 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -363,7 +363,7 @@ function setImplmentationMethods (self) { | |||
| 363 | 363 | ||
| 364 | 364 | return bytesWritten; | |
| 365 | 365 | }; | |
| 366 | - | ||
| 366 | + | ||
| 367 | 367 | var oldRead = self._readImpl; | |
| 368 | 368 | self._readImpl = function(buf, off, len, calledByIOWatcher) { | |
| 369 | 369 | assert(self.secure); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -164,7 +164,7 @@ Interface.prototype._ttyWrite = function (b) { | |||
| 164 | 164 | if (this.cursor === 0 && this.line.length === 0) { | |
| 165 | 165 | this.close(); | |
| 166 | 166 | } else if (this.cursor < this.line.length) { | |
| 167 | - this.line = this.line.slice(0, this.cursor) | ||
| 167 | + this.line = this.line.slice(0, this.cursor) | ||
| 168 | 168 | + this.line.slice(this.cursor+1, this.line.length) | |
| 169 | 169 | ; | |
| 170 | 170 | this._refreshLine(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -137,14 +137,14 @@ REPLServer.prototype.readline = function (cmd) { | |||
| 137 | 137 | ||
| 138 | 138 | /** | |
| 139 | 139 | * Used to parse and execute the Node REPL commands. | |
| 140 | - * | ||
| 140 | + * | ||
| 141 | 141 | * @param {cmd} cmd The command entered to check | |
| 142 | - * @returns {Boolean} If true it means don't continue parsing the command | ||
| 142 | + * @returns {Boolean} If true it means don't continue parsing the command | ||
| 143 | 143 | */ | |
| 144 | 144 | ||
| 145 | 145 | REPLServer.prototype.parseREPLKeyword = function (cmd) { | |
| 146 | 146 | var self = this; | |
| 147 | - | ||
| 147 | + | ||
| 148 | 148 | switch (cmd) { | |
| 149 | 149 | case ".break": | |
| 150 | 150 | self.buffered_cmd = ''; | |
@@ -171,7 +171,7 @@ REPLServer.prototype.parseREPLKeyword = function (cmd) { | |||
| 171 | 171 | }; | |
| 172 | 172 | ||
| 173 | 173 | function trimWhitespace (cmd) { | |
| 174 | - var trimmer = /^\s*(.+)\s*$/m, | ||
| 174 | + var trimmer = /^\s*(.+)\s*$/m, | ||
| 175 | 175 | matches = trimmer.exec(cmd); | |
| 176 | 176 | ||
| 177 | 177 | if (matches && matches.length === 2) { | |
@@ -183,26 +183,26 @@ function trimWhitespace (cmd) { | |||
| 183 | 183 | * Converts commands that use var and function <name>() to use the | |
| 184 | 184 | * local exports.context when evaled. This provides a local context | |
| 185 | 185 | * on the REPL. | |
| 186 | - * | ||
| 186 | + * | ||
| 187 | 187 | * @param {String} cmd The cmd to convert | |
| 188 | 188 | * @returns {String} The converted command | |
| 189 | 189 | */ | |
| 190 | 190 | REPLServer.prototype.convertToContext = function (cmd) { | |
| 191 | 191 | var self = this, matches, | |
| 192 | 192 | scopeVar = /^\s*var\s*([_\w\$]+)(.*)$/m, | |
| 193 | 193 | scopeFunc = /^\s*function\s*([_\w\$]+)/; | |
| 194 | - | ||
| 194 | + | ||
| 195 | 195 | // Replaces: var foo = "bar"; with: self.context.foo = bar; | |
| 196 | 196 | matches = scopeVar.exec(cmd); | |
| 197 | 197 | if (matches && matches.length === 3) { | |
| 198 | 198 | return "self.context." + matches[1] + matches[2]; | |
| 199 | 199 | } | |
| 200 | - | ||
| 200 | + | ||
| 201 | 201 | // Replaces: function foo() {}; with: foo = function foo() {}; | |
| 202 | 202 | matches = scopeFunc.exec(self.buffered_cmd); | |
| 203 | 203 | if (matches && matches.length === 2) { | |
| 204 | 204 | return matches[1] + " = " + self.buffered_cmd; | |
| 205 | 205 | } | |
| 206 | - | ||
| 206 | + | ||
| 207 | 207 | return cmd; | |
| 208 | 208 | }; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ var StringDecoder = exports.StringDecoder = function (encoding) { | |||
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | 13 | StringDecoder.prototype.write = function (buffer) { | |
| 14 | - // If not utf8... | ||
| 14 | + // If not utf8... | ||
| 15 | 15 | if (this.encoding !== 'utf8') { | |
| 16 | 16 | return buffer.toString(this.encoding); | |
| 17 | 17 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1166,7 +1166,7 @@ static Handle<Value> SetGid(const Arguments& args) { | |||
| 1166 | 1166 | } | |
| 1167 | 1167 | ||
| 1168 | 1168 | int gid; | |
| 1169 | - | ||
| 1169 | + | ||
| 1170 | 1170 | if (args[0]->IsNumber()) { | |
| 1171 | 1171 | gid = args[0]->Int32Value(); | |
| 1172 | 1172 | } else if (args[0]->IsString()) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -509,8 +509,8 @@ Handle<Value> Buffer::ByteLength(const Arguments &args) { | |||
| 509 | 509 | enum encoding e = ParseEncoding(args[1], UTF8); | |
| 510 | 510 | ||
| 511 | 511 | Local<Integer> length = | |
| 512 | - Integer::New(e == UTF8 ? s->Utf8Length() : s->Length()); | ||
| 513 | - | ||
| 512 | + Integer::New(e == UTF8 ? s->Utf8Length() : s->Length()); | ||
| 513 | + | ||
| 514 | 514 | return scope.Close(length); | |
| 515 | 515 | } | |
| 516 | 516 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,7 +24,7 @@ using namespace v8; | |||
| 24 | 24 | ||
| 25 | 25 | static Handle<Value> IsIP(const Arguments& args) { | |
| 26 | 26 | HandleScope scope; | |
| 27 | - | ||
| 27 | + | ||
| 28 | 28 | if (!args[0]->IsString()) { | |
| 29 | 29 | return scope.Close(Integer::New(4)); | |
| 30 | 30 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments