Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓
Being a Nerd...

Uilque Messias uqmessias

🤓
Being a Nerd...
View GitHub Profile
@uqmessias
uqmessias / devices-model-resolution.md
Last active Jun 26, 2020
Some Android devices dimensions
View devices-model-resolution.md
@uqmessias
uqmessias / normalize-dates-and-remove-reply-and-like-link-on-facebook.js
Last active Apr 13, 2020
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.
View normalize-dates-and-remove-reply-and-like-link-on-facebook.js
@uqmessias
uqmessias / .editorconfig
Last active Jul 23, 2019
Function to select the current screen on an react-navigation.navigation.routes
View .editorconfig
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
@uqmessias
uqmessias / removeAtRouteName.js
Last active Mar 27, 2019
Function to remove an single route from the navigation.route of react-navigation module
View removeAtRouteName.js
const removeAtRouteName = (state, routeName) => {
if (!routeName || !state.routes || !state.routes.length) {
return state;
}
const newState = { ...state };
let removed = false;
state.routes.forEach((currentRoute, index) => {
if (currentRoute.routeName === routeName) {
@uqmessias
uqmessias / replaceAtRouteName.js
Last active Oct 20, 2017
Function to replace route in a state with another route by routeName property
View replaceAtRouteName.js
const replaceAtRouteName = (state, routeName, route) => {
if (!route || !routeName || !state.routes) {
return state
}
const newState = { ...state }
let replaced = false
state.routes.forEach((value, index) => {
let replacedRoute = value
@uqmessias
uqmessias / loan-of-108000-reais-to-buy-a-house-from-caixa-federal.js
Last active Mar 7, 2019
This is some data extracted from a simulation at http://www8.caixa.gov.br/siopiinternet-web/simulaOperacaoInternet.do?method=inicializarCasoUso in order to get some money to buy an apartment in Brazil.
View loan-of-108000-reais-to-buy-a-house-from-caixa-federal.js
const payments = [
{
"nr": 1,
"payment": 1180.01
},
{
"nr": 2,
"payment": 1177.81
},
{
@uqmessias
uqmessias / logNavigationRoute.js
Last active Mar 5, 2018
This is a function to log (in form of a tree) the navigation based on `react-navigation` and redux state of this navigation.
View logNavigationRoute.js
type NavigationRoute = {
index?: ?number,
routeName: string,
routes?: ?Array<NavigationRoute>,
};
type FormattedState = {
children: Array<FormattedState>,
routeName: string,
View date-to-period.js
// @flow
export type TimePeriod = 'am' | 'pm';
export type TimeOfTheDay = { hour: number, minute: number, period: TimePeriod };
const getTimeOfTheDay = (date: Date): TimeOfTheDay => ({
hour: date.getHours() > 12 ? date.getHours() - 12 : date.getHours(),
minute: date.getMinutes(),
period: date.getHours() >= 12 ? 'pm' : 'am',
});
@uqmessias
uqmessias / all-png-to-svg.sh
Created Mar 13, 2018
Single line command to convert all png in the current directory to svg files.
View all-png-to-svg.sh
( set -x ; for f_png in *.png ; do f="${f_png%.png}" ; convert "$f_png" -flatten "$f.pgm" && potrace "$f.pgm" -s -o "$f.svg" ; done )
@uqmessias
uqmessias / .gitconfig
Last active Jul 23, 2019
My default .gitconfig with some alias
View .gitconfig
[user]
name = Uilque Messias
[alias]
graph = log --graph --oneline --all --decorate --stat
graphall = log --graph --all --decorate --stat
pull = pull --rebase
graphline = log --graph --oneline --all --decorate
delbranch = "!f() { git push origin :\"$1\" --no-verify && git branch -d \"$1\"; }; f"
contributors = shortlog -s -n --no-merges
You can’t perform that action at this time.