sysbench --test=cpu --cpu-max-prime=20000 run
(all ubuntu 16)
Scaleway DEV1-S = 2.40ms
Scaleway VC1M = 2.51ms
Scaleway VC1S = 2.56ms
Local Machine (Mackbook Pro 2015) = 2.66ms
| const { isPlainObject } = require('lodash'); | |
| function objectRecursionAndTransformationTemplate(obj) { | |
| if (!obj || !(isPlainObject(obj) || Array.isArray(obj))) { | |
| // put your primitive val transformations here | |
| return obj; | |
| } | |
| if (Array.isArray(obj)) { | |
| // put your array transformations here | |
| return obj.map(objectRecursionAndTransformationTemplate); |
| const postAndCancelPrevCall = (() => { | |
| let cancelTokenInstance; | |
| return async (body) => { | |
| try { | |
| if (cancelTokenInstance) { | |
| cancelTokenInstance.cancel('cancelled by user'); | |
| } | |
| cancelTokenInstance = CancelToken.source(); | |
| const axiosResponse = await axios.post(body, { | |
| cancelToken: cancelTokenInstance.token |
| function chain(value) { | |
| return { | |
| /** | |
| * @param {function|string} func function or function name (in chained value) | |
| * @param {...any} args | |
| */ | |
| fn(func, ...args) { | |
| if (typeof func === 'string') { | |
| return chain(value[func](...args)); | |
| } |
| // Law of Absurd Reduces: Everything that can be implemented with reduce() will eventually be implemented with reduce() | |
| /** | |
| * @param {Object} chainableFunctions object where each key is the name of a function and it's value is the function itself | |
| */ | |
| const createChainables = (chainableFunctions) => ({ | |
| chain(initialValue) { | |
| const operations = []; | |
| const evaluate = () => operations.reduce( | |
| (value, [func, ...args]) => func(value, ...args), |
A framework that lets you write your entire UI
| <html lang="en"> | |
| <head> | |
| <script src="https://unpkg.com/neverland@4.0.0/min.js"></script> | |
| </head> | |
| <body> | |
| <div id="app1"></div> | |
| <div id="app2"></div> | |
| <script type="module"> | |
| const { neverland: $, render, html, useState } = neverland; |
| <html lang="en"> | |
| <head> | |
| <script src="https://unpkg.com/neverland@4.0.0/min.js"></script> | |
| <script> | |
| const { useState, useEffect } = neverland; | |
| const globalStateManager = (() => { | |
| // "The" global store | |
| let store = {}; | |
| // internal publisher-subscriber system to |
| <!-- the blur filter makes it look more like a placeholder than a final image --> | |
| <img src="./output.svg" style="width: 1200px; filter: blur(5px)" /> |
| import create, { State, StateSelector } from 'zustand'; | |
| // initialization | |
| const initialStates = { count: 0 }; // no need to add your actions here like how zustand README shows. | |
| const useStore = create(() => initialStates); | |
| const { getState, setState } = useStore; | |
| // usage within function component (reactive) | |
| const Component = () => { | |
| const count = useStore(state => state.count); |