Skip to content

Instantly share code, notes, and snippets.

View clebersonfalk's full-sized avatar

Cleberson Falk clebersonfalk

  • Java Software Engineer at ASAAS
  • Londrina - PR
View GitHub Profile
@clebersonfalk
clebersonfalk / Windows10_exclude_github_credentials.txt
Created June 11, 2019 20:25
Windows 10 exclude github credentials
https://stackoverflow.com/a/50918688
https://stackoverflow.com/a/39608906
@clebersonfalk
clebersonfalk / exclude_commit_remote.txt
Created June 11, 2019 20:23
Exclude commit remote on Github
git reset --hard HEAD~1
git push origin HEAD --force
Fonte: https://pt.stackoverflow.com/a/128580
@clebersonfalk
clebersonfalk / Media.java
Last active May 16, 2019 14:45
Calcular a média em Java, salvando o resultado em arquivo TXT
import java.io.*;
import java.text.DecimalFormat;
public class Media {
private static Double n1 = 0.0, n2 = 0.0, n3 = 0.0, n4 = 0.0, media = 0.0;
public static void main(String[] args) {
try {
@clebersonfalk
clebersonfalk / mysql_concat_notnull_trim_separator.sql
Last active April 26, 2019 13:27
MySQL - Concat Not Null and Trim Separator on start and in the end
SELECT
TRIM(BOTH ';' FROM CONCAT_WS(';',`u`.`email`,`u`.`other_email`)) as emails,
`u`.`nome`
FROM
desk_20.`users` AS `u`
WHERE
(u.id_role = 2)# Admins
AND (u.status = 1)
AND (u.deleted = 0);
@clebersonfalk
clebersonfalk / mysql_update_join_concat.sql
Created April 24, 2019 19:26
MySQL Update Join Concat
UPDATE desk_24.fases_processuais fp1
INNER JOIN desk_24.fases_processuais fp2 ON(fp2.id = fp1.id)
SET fp1.resumos = IF(fp2.resumos IS NULL,'13,14,15,16,17,18,19',CONCAT(fp2.resumos, ',13,14,15,16,17,18,19'))
WHERE fp1.id IN(90,91,92);
@clebersonfalk
clebersonfalk / mysql_select_variable.sql
Created April 8, 2019 20:09
MySQL - Select with variables, prepare statement
SET @id_escritorio := '18';
SET @query1 = CONCAT('SELECT * FROM escritorio_', @id_escritorio,'.banco ORDER BY id_banco DESC');
PREPARE stmt1 FROM @query1;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;
@clebersonfalk
clebersonfalk / chrome_extension_trello.js
Created March 13, 2019 18:25
Chrome Extension - Show Trello cards ids and cards by lists
(function () {
showCardId();
countCardsByList();
})();
function showCardId() {
var cards_id = document.querySelectorAll('.card-short-id');
for (var i=0; i < cards_id.length; i++) {
id = cards_id[i].textContent;
@clebersonfalk
clebersonfalk / JS_window_event_iterate_nodelist.js
Created March 8, 2019 18:32
JS - window ready event in pure Javascript, iterate NodeList
(function () {
// Window ready event in pure JS
window.addEventListener('load', ready, false);
function ready () {
changeNum(7);
}
function changeNum (num = 1) {
@clebersonfalk
clebersonfalk / mask_phonenumber_10_or_11_digits.js
Created February 15, 2019 18:54
Mask input phone number with 10 or 11 digits
$(document).on('keypress', '.telefones', function () {
applyMask();
});
function applyMask(){
$('.telefones').each(function(index, elem){
var fone = $(this).val();
fone = fone.replace(/\D/g, '');
if (fone.slice(0,4) == '0800') {
$(this).unmask();
@clebersonfalk
clebersonfalk / mysql_database_size.sql
Last active January 31, 2019 19:18
Mysql - Get Database sum of data and indexes sizes
# Database size of data + indexes
SELECT
SUM((DATA_LENGTH + INDEX_LENGTH)) db_bytes,
ROUND(SUM((((DATA_LENGTH + INDEX_LENGTH) / 1024) / 1024)), 2) AS db_mb,
ROUND(SUM((((DATA_LENGTH + INDEX_LENGTH) / 1024) / 1024) / 1024), 2) AS db_gb
ROUND(SUM((DATA_LENGTH + INDEX_LENGTH) / 1073741824), 2) AS db_gb2
FROM
INFORMATION_SCHEMA.PARTITIONS
WHERE
TABLE_SCHEMA = 'db_store_122';