Skip to content

Instantly share code, notes, and snippets.

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;
}
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 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(){
Math.randInt = function(f, t) {
var from = (t) ? f : 0;
var to = t || f;
return from + (Math.random() * (to - from + 1)).floor();
}
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);
do {
for (int i = 0; i < 5; i++) {
System.out.println(i);
}
} while(true);
var express = require('express')
, HTTPServer = express.HTTPServer
, HTTPSServer = express.HTTPSServer;
exports.step = function(fn) {
(this._bootStack = this._bootStack || []).push(fn);
};
exports.boot = function(fn) {
#include "basics.h"
namespace basics {
void init(Handle<Object> target) {
NODE_SET_METHOD(target, "init", Init);
}
#lang r5rs
(define-syntax var
(syntax-rules ()
((_ x) (vector x))))
(define-syntax var?
(syntax-rules ()
((_ x) (vector? x))))
function promise() {
var finished = false,
result = null,
waiters = [];
return {
fulfil: function(res) {
finished = true;
result = res;
forEach(waiters, function(cb) {
cb(result);