const cdc = ({ x, start }) => {
if (x % 5000000 === 0) {
gc()
console.log({
used: process.memoryUsage(),
x,
time: Date.now() - start,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mssql, { Request } from 'mssql' | |
import colors from 'colors' | |
import config from 'config' | |
import squel from 'squel' | |
const squelMssql = squel.useFlavour('mssql') | |
// import configurationStreams from './kafka/configuration' | |
// import runtimeStreams from './kafka/runtime' |
given
const compose = (...functions) =>
(...params) =>
functions
.reduce(
(acc, func) => [func(...acc)],
params,
)[0]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default (...functions) => | |
param => | |
functions | |
.reduce( | |
(acc, func) => func(acc), | |
param, | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// serialises access to an action | |
export default () => { | |
// promise to allow the next action | |
let next = Promise.resolve() | |
return (action) => { | |
let nextResolve | |
const nextNext = () => new Promise( | |
(resolve, reject) => | |
action() | |
.then( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
/** | |
* @module opcua.server | |
* | |
*/ | |
const assert = require("node-opcua-assert").assert; | |
const _ = require("underscore"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a reduce function for a generator | |
// the result of the reducer function gets passed into next | |
function reduce( | |
reducer, | |
seed, | |
) { | |
const gen = this(seed); | |
let acc = seed; | |
let results = []; | |
let next = gen.next(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { marbles } from 'rxjs-marbles'; | |
/* eslint-env mocha */ | |
/* eslint-disable no-unused-expressions */ | |
describe('merge scan', () => { | |
it( | |
'should work', | |
marbles( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var edge = require('edge'); // http://tjanczuk.github.io/edge | |
var Rx = require('rxjs'); // https://github.com/Reactive-Extensions/RxJS | |
var createSubject = edge.func({ | |
// this is c# | |
source: function () {/* | |
using System.Reactive.Linq; | |
using System.Reactive.Subjects; | |
using ClassLibrary1; | |
async (dynamic input) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function map(func) { | |
return this.reduce( | |
(acc, val) => [ | |
...acc | |
func(val), | |
], | |
[], | |
); | |
} |
NewerOlder