Skip to content

Instantly share code, notes, and snippets.

@joakimbeng
joakimbeng / test_runner.js
Last active July 12, 2020 22:38
A small and simple Javascript test runner
/**
* A Javascript test runner in 20 lines of code
* From http://joakimbeng.eu01.aws.af.cm/a-javascript-test-runner-in-20-lines/
*/
(function () {
// The test queue:
var tests = [];
// Function to add tests:
this.test = function test (name, cb) {
@kolodny
kolodny / bookmarklet.js
Last active February 23, 2019 17:43
Save any form to autofill for development, supports dynamic content with {{ Math.random() }} syntax
http://kolodny.github.io/bookmarklet.html
document.body.addEventListener('click', go);
alert('click on a form element to get a bookmarklet of the saved form');
function go(event) {
var form = event.target;
while (form && form.tagName !== 'FORM') {
form = form.parentNode;
}
@karthik20522
karthik20522 / img_benchmark.js
Created November 22, 2013 19:01
Image processing benchmark - NodeJS
var fs = require('fs');
var vips = require('../index');
var imagemagick = require("imagemagick");
var gm = require("gm");
var epeg = require("epeg");
var async = require("async");
var assert = require("assert");
var Benchmark = require("benchmark");
var cv = require("opencv");
@malkafly
malkafly / the80.js
Last active August 29, 2015 14:13 — forked from rodrigoalviani/the80.js
$('*').each(function () {
var colors = ['aqua', 'blue', 'fuchsia', 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple', 'red', 'silver', 'teal', 'yellow'];
$(this).css('background-color', colors[Math.floor(Math.random()*colors.length)]);
$(this).css('font-family', 'Comic Sans MS');
});
$('img').each(function () {
var imgs = [
'http://www.animatedgif.net/devilish/coolskul.gif',
'http://www.animatedgif.net/devilish/devildance_e0.gif',