Skip to content

Instantly share code, notes, and snippets.

View AndersonFirmino's full-sized avatar
🐍
📜 🎼 🎮 🐧 🦆

Anderson Araujo AndersonFirmino

🐍
📜 🎼 🎮 🐧 🦆
View GitHub Profile
@AndersonFirmino
AndersonFirmino / js-timeout-polyfill.js
Created April 22, 2020 14:28 — forked from kayhadrin/js-timeout-polyfill.js
Nashorn setTimeout polyfill
/**
* js-timeout-polyfill
* @see https://blogs.oracle.com/nashorn/entry/setinterval_and_settimeout_javascript_functions
*/
(function (global) {
'use strict';
if (global.setTimeout ||
global.clearTimeout ||
global.setInterval ||
@AndersonFirmino
AndersonFirmino / md5.js
Created February 5, 2020 21:10 — forked from No14/md5.js
a javascript md5 generator
// form http://blueimp.github.com/JavaScript-MD5/
var md5 = function (str) {
/*
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters.
*/
function safe_add(x, y) {
var lsw = (x & 0xFFFF) + (y & 0xFFFF),
msw = (x >> 16) + (y >> 16) + (lsw >> 16);
@AndersonFirmino
AndersonFirmino / formatMoney.js
Created December 13, 2019 17:44
Formatar moeda no valor $ americano para R$ real.
function formatMoney(n, c, d, t) {
c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}
console.log(formatMoney(600000.00));
console.log(formatMoney(10));
console.log(formatMoney(100));
console.log(formatMoney(0.5));
console.log(formatMoney(1500));
console.log(formatMoney(89));
@AndersonFirmino
AndersonFirmino / unixToolbox.md
Created November 7, 2019 01:52 — forked from tokhi/unixToolbox.md
Collection of Unix/Linux/BSD commands and tasks which are useful for IT work or for advanced users.

#Unix Toolbox

This document is a collection of Unix/Linux/BSD commands and tasks which are useful for IT work or for advanced users. This is a practical guide with concise explanations, however the reader is supposed to know what s/he is doing.

##Unix Toolbox revision 14.4

The latest version of this document can be found at http://cb.vu/unixtoolbox.xhtml. Replace .xhtml on the link with .pdf for the PDF version and with .book.pdf for the booklet version. On a duplex printer the booklet will create a small book ready to bind. This XHTML page can be converted into a nice PDF document with a CSS3 compliant application (see the script example). See also the about page.
Error reports and comments are m
@AndersonFirmino
AndersonFirmino / lista_de_estados.py
Created May 28, 2019 19:39
Lista de estados brasileiros em dicionario Python
states = {
'AC': 'Acre',
'AL': 'Alagoas',
'AP': 'Amapá',
'AM': 'Amazonas',
'BA': 'Bahia',
'CE': 'Ceará',
'DF': 'Distrito Federal',
'ES': 'Espírito Santo',
@AndersonFirmino
AndersonFirmino / Post-RubyRails.md
Created November 5, 2018 18:24 — forked from lucasnogueira/Post-RubyRails.md
Para aprender Ruby e Rails

É difícil falar de Ruby sem mencionar seu framework web mais famoso, Ruby on Rails. Mas não adianta muito encarar o framework sem um prévio estudo da linguagem (o que de fato já observei acontecer inúmeras vezes). Esse post tem como intuito auxiliar na aprendizagem tanto da linguagem como do framework, para evitar que erros comuns como esse tornem a utilização de ambos um desastre.

Ruby

Ruby é uma linguagem de programação que apareceu para o mundo em 1995, criada por Yukihiro "Matz" Matsumoto. Tem como características o fato de ser uma linguagem de uso geral, com tipagem dinâmica e forte, orientada a objetos e que incorpora diversos paradigmas de programação, como o funcional e o imperativo.

Iniciantes

  • Ruby in Twenty Minutes - É o que o nome diz: um pequeno tutorial que promete não tomar mais do que 20 minutos do seu tempo. Se encarrega de mostrar como baixar e instalar o Ruby. Faz grande uso da IRB (Int
@AndersonFirmino
AndersonFirmino / create_timer.gd
Created October 24, 2018 15:43 — forked from brunosxs/create_timer.gd
Godot Quick Tips 01: The create_timer() helper for waiting X seconds
# Available only in the 2.2 legacy branch and posterior versions
func _ready():
# The old way:
print("HELLO") # Code before the yield
# Setting up the yield:
var t = Timer.new() # Create a new Timer node
t.set_wait_time(5.5) # Set the wait time
add_child(t) # Add it to the node tree as the direct child
@AndersonFirmino
AndersonFirmino / bobp-python.md
Created October 10, 2018 16:58 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens