Skip to content

Instantly share code, notes, and snippets.

@saabi
saabi / bench.js
Created May 10, 2012 01:03 — forked from eldargab/bench.js
Benchmark str concatenation
var Benchmark = require('benchmark')
var suite = new Benchmark.Suite
suite
.add('push', function () {
var a = []
a.push("Lorem")
a.push("ipsum")
a.push("dolor")
@saabi
saabi / bench.js
Created May 10, 2012 01:25 — forked from chowey/bench.js
Benchmark str concatenation
var Benchmark = require('benchmark');
var suite = new Benchmark.Suite,
a, b;
global.str = 'TextTextTextTextTextTextTextTextTextTextTextTextTextTextText\n';
global.str2 = 'TextTextTextTextTextTextTextTextTextTextTextTextTextTextText\\n';
var statement = 'var str = global.str;\nvar s=';
for (i=0; i<100; i++)
@saabi
saabi / JadeTmpltBench.js
Created May 10, 2012 13:45
Simple optimization of a compiled Jade template
self =
{
header: "Header",
header2: "Header2",
header3: "Header3",
header4: "Header4",
header5: "Header5",
header6: "Header6",
list: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
};
@saabi
saabi / index.html
Created December 8, 2016 21:10 — forked from Spyryto/index.html
For loop benchmark (http://jsbench.github.io/#67b13d4e78cdd0d7a7346410d5becf12) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>For loop benchmark</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@saabi
saabi / index.html
Last active December 8, 2016 22:05
Array Initialization Tests #jsbench #jsperf (http://jsbench.github.io/#1c61c959206599ac435b9abb26e09a34) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Array Initialization Tests #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@saabi
saabi / machine.js
Last active September 29, 2020 16:10
Generated by XState Viz: https://xstate.js.org/viz
Machine({
"id": "TestingBuilder",
"type": "parallel",
"context": {
"autoExecute": false,
"cached": false,
"hideDisabledAxes": true,
"hideDisabledAggs": false,
"hideDisabledDatasets": false,
"hideDisabledItems": true,
@saabi
saabi / machine.js
Created August 19, 2020 15:39
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@saabi
saabi / machine.js
Last active December 22, 2020 19:17
Generated by XState Viz: https://xstate.js.org/viz
Machine({
"id": "Form",
"initial": "CheckingSelection",
"on": {
"SELECTION_CHANGED": {
"target": "CheckingSelection",
"actions": [
"clearQuery",
"setSelection",
"sendEdited",
@saabi
saabi / Example Gist Title
Last active July 22, 2021 16:48
A Gist that is updated multiple times in a GH action
{
"prop1": "a second report"
}
@saabi
saabi / machine.js
Last active February 17, 2022 02:57
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: "fileFetcher",
initial: "pending",
context: {
uri: ''
},
states: {
pending: {
on: {
CANCEL: {