Skip to content

Instantly share code, notes, and snippets.

Gábor Soós blacksonic

Block or report user

Report or block blacksonic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@blacksonic
blacksonic / webpack.config.js
Created Apr 3, 2018
All the new things: setting up Webpack 4 with Babel 7 - part 4
View webpack.config.js
'use strict';
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
@blacksonic
blacksonic / index.html
Created Apr 3, 2018
All the new things: setting up Webpack 4 with Babel 7 - part 3
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Webpack Showcase</title>
</head>
<body></body>
</html>
@blacksonic
blacksonic / webpack.config.js
Created Apr 3, 2018
All the new things: setting up Webpack 4 with Babel 7 - part 2
View webpack.config.js
'use strict';
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
plugins: [
new HtmlWebpackPlugin({
template: 'src/index.html'
})
]
@blacksonic
blacksonic / package.json
Last active Apr 3, 2018
All the new things: setting up Webpack 4 with Babel 7 - part 1
View package.json
{
"scripts": {
"start": "webpack --mode=development",
"build": "webpack --mode=production"
}
}
@blacksonic
blacksonic / packages.js
Created Feb 14, 2018
Logging in microservices - part 3
View packages.js
const Koa = require('koa');
const clsAdapter = require('@emartech/cls-adapter');
const LogFactory = require('@emartech/json-logger');
LogFactory.configure({
transformers: [
clsAdapter.addContextStorageToInput()
]
});
const app = new Koa();
@blacksonic
blacksonic / koa.js
Last active Feb 3, 2018
Logging in microservices - part 2
View koa.js
'use strict';
const Koa = require('koa');
const als = require('async-local-storage');
const uuid = require('uuid/v4');
const axios = require('axios');
const app = new Koa();
als.enable();
@blacksonic
blacksonic / async_hooks.js
Created Jan 29, 2018
Logging in microservices - part 1
View async_hooks.js
const async_hooks = require('async_hooks');
const asyncHook = async_hooks.createHook({
init: function(asyncId, type, triggerAsyncId, resource) {},
before: function(asyncId) {},
after: function(asyncId) {},
destroy: function(asyncId) {}
});
asyncHook.enable();
@blacksonic
blacksonic / observable-promise.js
Created Oct 24, 2017
Clarifying Observables - part 6
View observable-promise.js
promise.then((value) => {
return value + 5;
}).then((value) => {
return Promise.resolve(9);
});
observable.map((value) => {
return value + 5;
}).flatMap((value) => {
return Rx.Observable.of(9);
@blacksonic
blacksonic / observable.js
Created Oct 24, 2017
Clarifying Observables - part 5
View observable.js
const observable = Rx.Observable.interval(1000).take(5);
observable.subscribe(function(x) {
console.log('A next ' + x);
}); // create an execution
setTimeout(function () {
observable.subscribe(function(x) {
console.log('B next ' + x);
}); // create an execution
@blacksonic
blacksonic / subject.js
Created Oct 24, 2017
Clarifying Observables - part 4
View subject.js
const subject = new Rx.Subject();
let observableResult;
subject.subscribe((val) => {
observableResult = val;
console.log('resolved observable', val);
});
subject.next(15);
console.log('result observable', observableResult); // result observable 15
You can’t perform that action at this time.