Skip to content

Instantly share code, notes, and snippets.

@aheckmann
aheckmann / parallelism.js
Created January 28, 2015 02:25
configurable parallelism
/**
* example of configurable parallelism
*/
// silly counter
var i = 0;
// configurable amount of work to run in parallel
var max = 1;
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<title>Detecting Stylesheet Load Test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
jQuery(function () {
var css = document.createElement('link');
css.type = 'text/css';
// partial example
/**
folder structure
/views
- home.haml.html
/partials
- world.haml.html
var sys = require('sys');
var uuid = function() {
var uuid = '', i;
for (i = 0; i < 32; i++) {
uuid += Math.floor(Math.random() * 16).toString(16);
}
return uuid;
};
var a = {}, u, index=[];
From f4554917d120b994022ed261bdbd4268c476cc0e Mon Sep 17 00:00:00 2001
From: Aaron Heckmann <aaron.heckmann@gmail.com>
Date: Wed, 16 Jun 2010 00:52:15 -0400
Subject: [PATCH] fs.writeFile accepts Buffers
---
lib/fs.js | 4 +++-
test/simple/test-fs-write-file.js | 21 ++++++++++++++++++++-
2 files changed, 23 insertions(+), 2 deletions(-)
174.121.106.162 - - [23/Aug/2010 23:47:35] "GET /w00tw00t.at.blackhats.romanian.anti-sec:) HTTP/1.1" 404 113 0.0020 "-" "ZmEu"
21684 174.121.106.162 - - [23/Aug/2010 23:47:35] "GET /scripts/setup.php HTTP/1.1" 404 113 0.0000 "-" "ZmEu"
21685 174.121.106.162 - - [23/Aug/2010 23:47:35] "GET /admin/scripts/setup.php HTTP/1.1" 404 113 0.0000 "-" "ZmEu"
21686 174.121.106.162 - - [23/Aug/2010 23:47:35] "GET /admin/pma/scripts/setup.php HTTP/1.1" 404 113 0.0000 "-" "ZmEu"
21687 174.121.106.162 - - [23/Aug/2010 23:47:35] "GET /admin/phpmyadmin/scripts/setup.php HTTP/1.1" 404 113 0.0010 "-" "ZmEu"
21688 174.121.106.162 - - [23/Aug/2010 23:47:35] "GET /db/scripts/setup.php HTTP/1.1" 404 113 0.0000 "-" "ZmEu"
21689 174.121.106.162 - - [23/Aug/2010 23:47:35] "GET /dbadmin/scripts/setup.php HTTP/1.1" 404 113 0.0000 "-" "ZmEu"
21690 174.121.106.162 - - [23/Aug/2010 23:47:35] "GET /myadmin/scripts/setup.php HTTP/1.1" 404 113 0.0000 "-" "ZmEu"
21691 174.121.106.162 - - [23/Aug/2010 23:47:35] "GET /mysql/scripts/setup.php HTT
fn1(
{ key: 1
, bar: 2
, baz: 3
}
)
fn2({
foo: 1
, bar: 2
process.on('SIGINT', function(){
console.log('bye');
process.exit(0);
});
setTimeout(function(){}, 4000);
var start = new Date;
var times = 2;
var i = 0;
for (; i < times; ++i) {
var num = 1000;
while (num--) {
require('./'+num);
@aheckmann
aheckmann / arguments-callee.js
Created January 18, 2011 23:19
arguments.callee is slower than a named function
var index;
function test (method) {
index = 0;
var start = new Date;
var i = 1000000;
while (--i) method();
console.log(new Date - start);
}