Skip to content

Instantly share code, notes, and snippets.

View bajtos's full-sized avatar

Miroslav Bajtoš bajtos

View GitHub Profile
/* Code generated by cmd/cgo; DO NOT EDIT. */
/* package main */
#line 1 "cgo-builtin-export-prolog"
#include <stddef.h>
#ifndef GO_CGO_EXPORT_PROLOGUE_H
@bajtos
bajtos / test.js
Created March 19, 2021 08:57
LoopBack datasource test
'use strict';
// Make sure to `npm install loopback-datasource-juggler`
const juggler = require('loopback-datasource-juggler');
const ds = new juggler.DataSource({
connector: 'memory', // replace with 'oracle'
// additional connector config - hostname, database, credentials, etc.
});
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:3:bafyreicng44yb7qyg6zrtvdspdgein7ayd5o2qigyifyo5fg4br5e5vuv4 ✅
Create your profile today to start building social connection and trust online at https://3Box.io/
@bajtos
bajtos / todo.md
Created September 18, 2020 14:38
Random ideas for LoopBack
@bajtos
bajtos / db.datasource.ts
Last active August 8, 2020 20:35
How to intercept LoopBack connector's execute method to implement retry mechanism
@lifeCycleObserver('datasource')
export class DbDataSource extends juggler.DataSource
implements LifeCycleObserver {
static dataSourceName = 'db';
static readonly defaultConfig = config;
constructor(
@inject('datasources.config.db', {optional: true})
dsConfig: object = config,
) {
@bajtos
bajtos / bench-output.txt
Last active June 2, 2020 08:55
Benchmark of generating unique IDs
== BEFORE ==
counter variable len: 24575-1
counter fixed length: 24575-0000000002
uuid v1: 60841ff0-a3f8-11ea-8da7-c5c2ea413f33
uuid v4: 767992e9-caa4-4e51-b694-2d7f0f85a7b1
hyperid variable len: D0TU/ybLT6u5DxndKGF2hg/0
hyperid fixed length: +OBh7XGXRsOViCS5XcghsQ/0000000000
== BENCHMARK ==
counter variable len: x 11,095,695 ops/sec ±1.50% (87 runs sampled)
@bajtos
bajtos / debug.log
Last active May 28, 2020 09:53
typescript-eslint out of memory
This file has been truncated, but you can view the full file.
2020-05-28T09:47:15.118Z loopback:build /Users/bajtos/src/loopback/next/.eslintrc.js found
2020-05-28T09:47:15.119Z loopback:build /Users/bajtos/src/loopback/next/.eslintignore found
2020-05-28T09:47:15.119Z loopback:build Trying to resolve CLI module 'eslint' from /Users/bajtos/src/loopback/next
2020-05-28T09:47:15.120Z loopback:build Resolved CLI module 'eslint': /Users/bajtos/src/loopback/next/node_modules/eslint/bin/eslint.js
2020-05-28T09:47:15.120Z loopback:build /Users/bajtos/src/loopback/next/node_modules/eslint/bin/eslint.js -c /Users/bajtos/src/loopback/next/.eslintrc.js --ignore-path /Users/bajtos/src/loopback/next/.eslintignore --ext .js,.ts --report-unused-disable-directives --cache .
2020-05-28T09:47:15.120Z loopback:build Spawn /usr/local/bin/node /Users/bajtos/src/loopback/next/node_modules/eslint/bin/eslint.js -c /Users/bajtos/src/loopback/next/.eslintrc.js --ignore-path /Users/bajtos/src/loopback/next/.eslintignore --ext .js,.ts --report-unused-disable-directives --cache .
2020-05-28T09:47:1
@bajtos
bajtos / fix-index-files.js
Last active May 15, 2020 08:00
Rework loopback-next infrastructure to remove top-level index files
// Copyright IBM Corp. 2019. All Rights Reserved.
// Node module: loopback-next
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
'use strict';
const path = require('path');
const fs = require('fs-extra');
@bajtos
bajtos / src __snapshots__ integration test.snapshot.js
Created September 17, 2019 08:49
Proof of concept helper for snapshot testing in Mocha
exports['mocha snapshot checker always works for strings'] = `
foo
hello
world
`.slice(1, -1); // remove leading & trailing newlines
exports['mocha snapshot checker always works for objects'] = {
key: 'valuex',
number: 1,
};

Keybase proof

I hereby claim:

  • I am bajtos on github.
  • I am bajtos (https://keybase.io/bajtos) on keybase.
  • I have a public key ASAafG6dsFzJZ9SVtOS-eR08_Z5Rz4vyfYwRcs2OQ0tDgwo

To claim this, I am signing this object: