Skip to content

Instantly share code, notes, and snippets.

View rluvaton's full-sized avatar
:octocat:
Programming

Raz Luvaton rluvaton

:octocat:
Programming
View GitHub Profile
@rluvaton
rluvaton / pouchdb-benchmark.js
Created February 7, 2019 16:10 — forked from perliedman/pouchdb-benchmark.js
PouchDB Benchmark
var dbName = 'http://localhost:5984/couch-test',
nDocs = 10000,
batchSize = 1000,
scrapFactor = 0,
docs = [],
testQuery = 'entries/sumTime',
destroyDb = false,
_log = console.log,
db;
@rluvaton
rluvaton / type-check.mjs
Created January 31, 2024 16:44
TypeCheck only on typescript project files
import ts from 'typescript';
import path from 'node:path';
import Debug from 'debug';
const debug = Debug('type-check-only-project-files');
// ----------------------------------------------------------------
// This file is a helper file that can be used to run type check
// only for the files that in the project and not for any other file
@rluvaton
rluvaton / mongo-error-code.ts
Last active October 23, 2023 06:41
Mongo Error Code #mongo #ts
export enum MongoErrorCode {
OK = 0,
InternalError = 1,
BadValue = 2,
OBSOLETE_DuplicateKey = 3,
NoSuchKey = 4,
GraphContainsCycle = 5,
HostUnreachable = 6,// Categories: NetworkError, RetriableError
HostNotFound = 7,// Categories: NetworkError, RetriableError
UnknownError = 8,
@rluvaton
rluvaton / README.md
Last active October 15, 2023 19:10
Bundle install for mac that temporarly disable IPv6 for network interface while downloading

Fixed bundle install for MacOS

This is a zx script that fix bundle install

How to run:

The bundle-install file should be without extension (but not required) added the extension to make GitHub syntax highlighting work

So from now we just gonna use bundle-install instead of bundle-install.mjs

@rluvaton
rluvaton / README.md
Last active October 9, 2023 15:14
v8 embedding benchmark creating 1M of objects

Benchmarks

  • cpp-creating-objects.cpp: 2000ms
  • js-creating-objects.cpp: 17ms
  • js-creating-object-in-cpp.cpp: 1800ms
@rluvaton
rluvaton / getFolderSize.js
Last active June 26, 2023 12:15
Get Folder Size - App Script
var count = 0;
function myFunction() {
Logger.log('Starting');
// Please Write the path of the folder you want sub path seperated with slash(,) (spaces are counted)
// for example: for myFolder/test -> myFolder,test
// And NOT myFolder, test
var folders = [];
if(!folders) {

❯ jest --coverage=true
  console.log
    test

      at log (index.js:12:21)

 PASS  ./index.test.js
 work
@rluvaton
rluvaton / Dockerfile
Created June 22, 2022 14:24
Elastic Search v6 with ARM support
FROM ubuntu:bionic-20220531
# Must be root to install the packages
USER root
# Install required deps
RUN apt update
RUN apt -y install gnupg wget apt-transport-https coreutils java-common
# Import Elasticsearch GPG Key
@rluvaton
rluvaton / nock-allow-single-port.ts
Created June 4, 2023 15:34
Nock allow connections to servers that the current process start them
import nock from 'nock';
import { Server } from 'http';
const kHttpServerListen = Symbol('kHttpServerListen');
const openServerPorts = new Set<number>();
function allowRemoteHttpRequestsOnlyToOurServer() {
nock.disableNetConnect();
nock.enableNetConnect(host => {
@rluvaton
rluvaton / README.md
Created November 16, 2022 19:23
Vitests vs Jest with workers

Jest vs Vitest

Results:

Max Workers Jest (time) Jest (max heap) Vitest (time) Vitest (max heap)
1 29.329 s 1244 MB 13.29s 149 MB
2 18.383 s 944 MB 7.58s 190 MB
4 12.914 s 832 MB 7.40s 203 MB
9 (max) 15.830 s 545 MB 8.80s 119 MB