Skip to content

Instantly share code, notes, and snippets.

View ra100's full-sized avatar
🦙

Rastislav Švarba ra100

🦙
View GitHub Profile
/* ===========================================================
* trumbowyg.cro.js v1.0
* Cro plugin for Tumbowyg
* http://alex-d.github.com/Trumbowyg
* ===========================================================
* Author : Rastislav Å varba (ra100)
* Twitter : @ra100
* Website : ra100.net
*/

Keybase proof

I hereby claim:

  • I am ra100 on github.
  • I am ra100 (https://keybase.io/ra100) on keybase.
  • I have a public key whose fingerprint is AE0E 3093 157C 2748 DC8C 3462 EE6D 01F5 AE38 3408

To claim this, I am signing this object:

@ra100
ra100 / asyncDelay.js
Last active January 12, 2018 18:42
How to simply delay Promises generated from array executed in Promise.all.
const time = Date.now();
const data = ["a", "b", "c", "d"];
// this is actually what I want
const delay = (cb, timeout) =>
new Promise(resolve => setTimeout(() => resolve(cb()), timeout));
// this simulates async call network/io operation
const fakeAsync = log =>
new Promise(resolve => {
@ra100
ra100 / cloudSettings
Last active October 17, 2019 07:46
cloudSettingsWork
{"lastUpload":"2019-10-17T07:46:37.594Z","extensionVersion":"v3.4.3"}
@ra100
ra100 / evaluation.js
Last active January 28, 2018 17:53
Normalize relative scales across multiple evaluations.
const DEFAULT_MODIFIER = { multiplier: 1, offset: 0, error: Number.MAX_VALUE }
const users = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']
const sourceData = [
{ A: 1, B: 0.8, C: 0.34, D: 0.33, E: 0 },
{ B: 1, A: 0.9, C: 0.85, F: 0.5, J: 0.1, G: 0 },
{ B: 1, H: 0.7, D: 0.5, J: 0.3, F: 0 },
{ C: 1, A: 0.9, B: 0.8, I: 0.6, E: 0.1, J: 0 }
]
const getAverage = arr =>
@ra100
ra100 / index.html
Last active November 2, 2018 13:05
webrtc
<!DOCTYPE html>
<html>
<head>
<title>Transmit text</title>
</head>
<body>
<h1>ALICE</h1>
<div class="text">test</div>
@ra100
ra100 / index.html
Created November 2, 2018 07:43
elephant-carpaccio
<html>
<head>
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous">
</script>
</head>
<h1>Elephant Shop</h1>
<div>
<h3>We have</h3>
<table>
@ra100
ra100 / arrays-spread-concat.js
Last active June 27, 2019 07:53
Perfomance comparison of arrays
#!/usr/bin/env node
const Benchmark = require('benchmark')
const spread = (d1, d2) => () => {
const d = [...d1, ...d2]
}
const concat = (d1, d2) => () => {
const d = d1.concat(d2)
@ra100
ra100 / README.md
Last active July 30, 2019 03:30
Node.js homework

Task

Implement API server (in Node.js) based on the API specification.

It shouldn't take more than one hour to do this.

We like:

  • Tests
  • Nice commit messages
  • Working code
@ra100
ra100 / Node.js array.map benchmark
Last active August 30, 2019 17:06
Benchmark on different node.js version
#!/bin/bash
export NODE_ENV=production
function benchmark {
echo $NODE_ENV
nvm use "$1"
rm -rf node_modules
npm i
node for-map.js >> results.txt