Skip to content

Instantly share code, notes, and snippets.

class Observer {
/**
*
* @param {*} observerKey Uniq key to identify the observer
* @param {*} eventName The event name to listen on
* @param {*} fn The function to run when the event is called
*/
constructor(observerKey, eventName, fn) {
this.fn = fn;
this.eventName = eventName;
@Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("api/v1/**").allowedOrigins(
"http://127.0.0.1:8081",
"http://localhost:8081"
)
}
|------------------------------------------------------------------------------------------|
| WinMTR statistics |
| Host - % | Sent | Recv | Best | Avrg | Wrst | Last |
|------------------------------------------------|------|------|------|------|------|------|
| belong.gateway - 7 | 363 | 340 | 1 | 5 | 102 | 2 |
// The executor in charge of executing the different crawls in its thread pool
ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
// Start all the crawl tasks in a separate Thread and get the results of each tasks in a Future
List<Future<List<MyDto>>> tasksResults = myList.stream()
.map(item -> {
// Create an instance of a Class that implements Callable<List<MyDto>> {
return executor.submit(instanceOfCallable);
}).collect(Collectors.toList());
<template>
<canvas :id="chartId"></canvas>
</template>
<script>
// Third libs
import Chart from 'chart.js';
// Quasar utils
// Quasar Components
// App Components
import { DateTime } from "luxon";
const DEFAULT_DATE = {
H24: { label: '24 Hours', hours: 24 },
D7: { label: '7 Days', hours: 24 * 7 },
D30: { label: '30 Days', hours: 24 * 30 }
}
/**
*
/**
* Wrapper for Http Request.
* Uses fetch API.
* Mocks are using the following convention : '/pathx/pathy' is fetching ./mock_api/pathx.pathy.js
* pathx.pathy.js is a javascript file exporting a default element : export default { prop: 'value' } or export default [{ prop: 'value' }]
*
* --- Usage with mocks
* ----- json under ./mock_api/i18n.EN.js
* > const langProps = await http.get<LocaleMessageDictionary<VueMessageType>>(`/i18n/${locale.code}`, undefined, true)
*