Skip to content

Instantly share code, notes, and snippets.

View fernandomoraes's full-sized avatar
🏠
Working from home

Fernando Moraes fernandomoraes

🏠
Working from home
View GitHub Profile
@fernandomoraes
fernandomoraes / single_threaded_promise_cache.js
Last active June 17, 2021 17:32
single_threaded_promise_cache.js
const caches = {}; //add some cache strategy (lru,...)
function execute(cacheId, executeFunction) {
if (caches[id]) {
//there's no problem on calling multiple times a resolve promise
return caches[id];
}
caches[id] = Promise.resolve(executeFunction);
return caches[id];
}
@fernandomoraes
fernandomoraes / Coverage badges
Created June 12, 2021 21:26
Coverage badges
Coverage badges
<script>
window.ga =
window.ga ||
function () {
(ga.q = ga.q || []).push(arguments);
};
ga.l = +new Date();
ga('create', 'UA-XXXXX-Y', 'auto');
ga('send', 'pageview');
</script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<button onclick="test()">CLICAR</button>
</body>
public interface MyCustomMetricsMBean {
long getTotalFoo();
}
final Class<? extends MyCustomMetricsMBean> objectClass = myCustomMetricsMBean.getClass();
ObjectName name = new ObjectName(
String.format("%s:type=basic,name=%s", objectClass.getPackage().getName(), objectClass.getName())
);
mBeanServer.registerMBean(myCustomMetricsMBean, name);
...
<parent>
 <groupId>org.springframework.boot</groupId>
 <artifactId>spring-boot-starter-parent</artifactId>
 <version>2.3.0.M4</version>
 <relativePath/>
 </parent>
https://jelastic.com/blog/tuning-garbage-collector-java-memory-usage-optimization/
https://docs.aws.amazon.com/pt_br/amazondynamodb/latest/developerguide/Streams.html
Regex:
area de neǵocio: /\$\$([^,]+)/
sudo docker run --network="host" -d -p 3000:3000 --name=grafana -e "GF_INSTALL_PLUGINS=simpod-json-datasource" grafana/grafana
var express = require('express');
var bodyParser = require('body-parser');
var _ = require('lodash');
var app = express();