Skip to content

Instantly share code, notes, and snippets.

View robertklep's full-sized avatar

Robert Klep robertklep

View GitHub Profile

Keybase proof

I hereby claim:

  • I am robertklep on github.
  • I am robertklep (https://keybase.io/robertklep) on keybase.
  • I have a public key whose fingerprint is F5E0 E8F1 5938 70C3 501D 2896 3CAF 44BE 0135 D038

To claim this, I am signing this object:

app.use(function(req, res, next) {
if (req.method === 'HEAD') {
res.on('finish', function() {
req.connection.end();
});
}
next();
});
public class Test {
public static void main(String[] args) {
long heapMaxSize = Runtime.getRuntime().maxMemory();
System.out.println("Max: " + heapMaxSize);
}
}
<h1>Anonymous</h1>
@robertklep
robertklep / test.js
Last active December 18, 2015 05:19
var async = require('async');
var locals = [];
var test = function(value, locals, done) {
console.log('value', value, 'locals', locals);
locals.push(value);
done();
};
async.series([
test.bind(null, 'this is #1', locals),
module.exports = function blah() {
console.log('N', this.name);
};
@robertklep
robertklep / bind.js
Last active December 18, 2015 04:59
var f = function(value) {
console.log('value:', value);
};
var x = f.bind(f, 'foo'); // pass 'foo' as a pre-specified argument to f(), and return it as a new function x()
x();
<!doctype html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
</head>
<body>
<img src="http://lorempixel.com/400/400">
<script>
var run = function() {
$('img')
var express = require('express');
var app = express();
app.use(express.bodyParser());
app.get('/users', function(req, res) {
console.log('B', req.body);
res.send('OK');
});
var async = require('async');
var fs = require('fs');
console.time('timeout');
setTimeout(function() {
console.timeEnd('timeout');
}, 500);
console.time('async.times');
async.times(100000, function(n, next) {