Skip to content

Instantly share code, notes, and snippets.

View uqmessias's full-sized avatar
🤓
Being a Nerd...

Uilque Messias uqmessias

🤓
Being a Nerd...
View GitHub Profile
@uqmessias
uqmessias / devices-model-resolution.md
Last active February 29, 2024 03:27
Some Android devices dimensions
@uqmessias
uqmessias / countries-names-and-flags-in-portuguese-brazil-pt-br.md
Last active November 10, 2023 17:54
The list of all (or almost all) countries with their names and flag codes in brazilian portuguese (pt-br) and english — Lista de todos (ou quase todos) os países com seus nome e códigos de bandeiras em português brasileiro (pt-br) e inglês.
var countriesInPortugueseBR = [
    {
      flag: 'af',
      nameEn: 'Afghanistan',
      namePt: 'Afeganistão',
    },
    {
      flag: 'za',
const SALARIO_MINIMO_MENSAL = 1320;
/**
* @param {number} valor
* @param {number} casaDecimais (para o valor `10.2345678`, usar 0 => 10, 1 => 10.2, 2 => 10.23, 3 => 10.235)
*/
function arredondar(valor, casasDecimais) {
const multiplicador = Math.pow(10, casasDecimais);
return Math.round(valor * multiplicador) / multiplicador;
}
@uqmessias
uqmessias / rgb-color-bitwise-conversion-kotlin.kt
Created February 20, 2023 23:46
It converts an RGB Int into a vector with R, G, and G color parts. It also does the same by inverting the R with G (this is needed for an internal project). And all of this in Kotlin
import java.awt.Color
/**
* Got from https://play.kotlinlang.org/#eyJ2ZXJzaW9uIjoiMS44LjEwIiwicGxhdGZvcm0iOiJqYXZhIiwiYXJncyI6IiIsIm5vbmVNYXJrZXJzIjp0cnVlLCJ0aGVtZSI6ImlkZWEiLCJjb2RlIjoiaW1wb3J0IGphdmEuYXd0LkNvbG9yXG4vKipcbiAqIFlvdSBjYW4gZWRpdCwgcnVuLCBhbmQgc2hhcmUgdGhpcyBjb2RlLlxuICogcGxheS5rb3RsaW5sYW5nLm9yZ1xuICovXG5mdW4gbWFpbigpIHtcbiAgICB2YWwgcmdiOiBJbnQgPSAweDFmOGI1NFxuICAgIFxuICAgIHZhbCByZ2JSZWRDb2xvcjogSW50ID0gKHJnYiBzaHIgMTYpIGFuZCAweEZGXG4gICAgdmFsIHJnYkdyZWVuQ29sb3I6IEludCA9IChyZ2Igc2hyIDgpIGFuZCAweEZGXG4gICAgdmFsIHJnYkJsdWVDb2xvcjogSW50ID0gcmdiIGFuZCAweEZGXG4gICAgXG4gICAgdmFsIGdiclJlZENvbG9yOiBJbnQgPSByZ2IgYW5kIDB4RkZcbiAgICB2YWwgZ2JyR3JlZW5Db2xvcjogSW50ID0gKHJnYiBzaHIgOCkgYW5kIDB4RkZcbiAgICB2YWwgZ2JyQmx1ZUNvbG9yOiBJbnQgPSAocmdiIHNociAxNikgYW5kIDB4RkZcbiAgICBcbiAgICB2YWwgZ2JyOiBJbnQgPSAocmdiUmVkQ29sb3IgYW5kIDB4RkYpIG9yICgocmdiR3JlZW5Db2xvciBhbmQgMHhGRikgc2hsIDgpIG9yICgocmdiQmx1ZUNvbG9yIGFuZCAweEZGKSBzaGwgMTYpXG4gICAgXG5cdHByaW50bG4oXCJSR0IgIyR7cmdiLnRvU3RyaW5nKDE2KX0sICRyZ2IgKFtyOiAkcmdiUmVkQ29sb

It sums a list of amounts within a markdown snippet

_**2079,30** (2022/01)_<br>  
_**2014,40** (2022/02)_<br>  
_**2161,51** (2022/03)_<br>  
_**226,29** (2022/04)_<br>  
_**2.283,29** (2022/05)_<br>  
_**223,92** (2022/06)_<br>  
_**222,48** (2022/07)_<br>  
@uqmessias
uqmessias / toCurrency.js
Created October 7, 2022 19:51
Format number to currency format
const toCurrency = num => num.toFixed(2).replace('.', ',').replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1.");
@uqmessias
uqmessias / DatePickerDialogFixedNougatSpinner.java
Last active March 26, 2022 11:08 — forked from jeffdgr8/TimePickerDialogFixedNougatSpinner.java
TimePickerDialog with fixed android:timePickerMode spinner in Nougat
package my.packagename;
import android.app.DatePickerDialog;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.DatePicker;
import java.lang.reflect.Field;
@uqmessias
uqmessias / base64.js
Created December 21, 2021 14:39
Function to transform string into base64
/**
*
* @param {string} str
*/
function base64(str) {
const base64Characters = [
"A",
"B",
"C",
"D",
@uqmessias
uqmessias / normalize-dates-and-remove-reply-and-like-link-on-facebook.js
Last active October 27, 2020 00:55
My wife did want to save some screenshots of our posts on facebook, but she wanted to remove all *like* and *reply* buttons. Besides, she wanted to change the relative date and time to an absotule one.
@uqmessias
uqmessias / ffmpeg.md
Created April 13, 2020 23:08 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz: