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
| RopeNode* Rope::AddNode(RopeNode* node) { | |
| if (this->head == NULL) { | |
| this->head = node; | |
| this->tail = node; | |
| } else { | |
| this->tail->SetNext(node); | |
| this->tail = node; | |
| } | |
| return this->tail; | |
| } |
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
| bool Player::IsColliding(Map * m) { | |
| bool topFirst = this->vel.y < 0; | |
| bool leftFirst = this->vel.x < 0; | |
| int width = this->mask->GetWidth(); | |
| int height = this->mask->GetHeight(); | |
| sf::IntRect maskAABB = this->GetAABB(this->prov); | |
| sf::IntRect mapAABB = m->GetAABB(); | |
| if (maskAABB.Intersects(mapAABB)) { |
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
| // This code, run with 10 concurrent users hitting both routes, results in /1 failing with a 404 at a rate ~50% | |
| var express = require('express'); | |
| var app = express.createServer(); | |
| app.configure(function(){ | |
| app.use(app.router); | |
| }); | |
| function mw(req, res, next) { | |
| setTimeout(function(){ |
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
| Math.randInt = function(f, t) { | |
| var from = (t) ? f : 0; | |
| var to = t || f; | |
| return from + (Math.random() * (to - from + 1)).floor(); | |
| } |
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
| cluster(server) | |
| .set('working directory', '/') | |
| .set('workers', 5) | |
| .use(cluster.logger('logs')) | |
| .use(cluster.stats()) | |
| .use(cluster.pidfiles('pids')) | |
| .use(cluster.cli()) | |
| .use(cluster.repl(8888)) | |
| .listen(3000); | |
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
| do { | |
| for (int i = 0; i < 5; i++) { | |
| System.out.println(i); | |
| } | |
| } while(true); |
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') | |
| , HTTPServer = express.HTTPServer | |
| , HTTPSServer = express.HTTPSServer; | |
| exports.step = function(fn) { | |
| (this._bootStack = this._bootStack || []).push(fn); | |
| }; | |
| exports.boot = function(fn) { |
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
| #include "basics.h" | |
| namespace basics { | |
| void init(Handle<Object> target) { | |
| NODE_SET_METHOD(target, "init", Init); | |
| } |
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
| #lang r5rs | |
| (define-syntax var | |
| (syntax-rules () | |
| ((_ x) (vector x)))) | |
| (define-syntax var? | |
| (syntax-rules () | |
| ((_ x) (vector? x)))) |
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
| function promise() { | |
| var finished = false, | |
| result = null, | |
| waiters = []; | |
| return { | |
| fulfil: function(res) { | |
| finished = true; | |
| result = res; | |
| forEach(waiters, function(cb) { | |
| cb(result); |
OlderNewer