Skip to content

Instantly share code, notes, and snippets.

View trfiladelfo's full-sized avatar

Thiago Filadelfo trfiladelfo

View GitHub Profile
@trfiladelfo
trfiladelfo / CPFValidator.kt
Last active April 27, 2024 18:59
Validador de CPF em Kotlin
fun isCPF(document: String): Boolean {
if (document.isEmpty()) return false
val numbers = document.filter { it.isDigit() }.map {
it.toString().toInt()
}
if (numbers.size != 11) return false
//repeticao
@trfiladelfo
trfiladelfo / script.md
Created July 6, 2019 17:28
install postman in linux mint

When it comes to API development, my weapon of choice for testing my code is Postman. I start using Postman since it's still a Chrome App. Now it encourages its user to use Postman Native app. I definitely love the idea, but all I can find is a download link without any installation document for Linux Mint.

So, here's what I did:

Download postman
$ wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz

Extract archive
$ sudo tar -xzf postman.tar.gz -C /opt
@trfiladelfo
trfiladelfo / example.java
Created August 29, 2019 16:05
simulate click android
view.setOnTouchListener(new OnTouchListener()
{
public boolean onTouch(View v, MotionEvent event)
{
Toast toast = Toast.makeText(
getApplicationContext(),
"View touched",
Toast.LENGTH_LONG
);
toast.show();
@trfiladelfo
trfiladelfo / CNPJValidator.kt
Last active October 3, 2022 17:10
Validador de CNPJ em Kotlin
fun isCNPJ(document: String): Boolean {
if (document.isEmpty()) return false
val numbers = document.filter { it.isDigit() }.map {
it.toString().toInt()
}.toMutableList()
if (numbers.size != 14) return false
//repeticao
@trfiladelfo
trfiladelfo / index.txt
Created December 16, 2017 00:17
Mac OS X: create/extract split zip archives
I. Create split zip archive
To create a split zip archive (a series of files named zip, z01, z02...), run following command in Terminal:
zip -s 100m -x "*.DS_Store" -r split-foo.zip foo/
II. Extract split zip archive
To extract a split zip archive (a series of files named zip, z01, z01...), run following command in Terminal:
First, combine the split archive to a single archive:
zip -s 0 split-foo.zip --out unsplit-foo.zip
Extract the single archive using unzip:
unzip unsplit-foo.zip
@trfiladelfo
trfiladelfo / main.kt
Created July 20, 2018 14:56
ZIP Android in Kotlin - Retrofit
override fun onResponse(call: Call<ResponseBody>?, response: Response<ResponseBody>?) {
val etag = headers["Etag"]
val body = response.body()!!
val location = App.storageDir(App.Storage.TEMP)
val zip = File(location, "$etag.zip")
/*if (!zip.exists()) {
zip.createNewFile()
}
@trfiladelfo
trfiladelfo / Code.gs
Created June 3, 2021 03:05 — forked from superstrong/Code.gs
Google Script to generate a UUID in Google Sheets
function getId() {
/**
* Imported from https://github.com/kyo-ago/UUID
* Robbie Mitchell, @superstrong
*/
/**
* UUID.core.js: The minimal subset of the RFC-compliant UUID generator UUID.js.
*
* @fileOverview
@trfiladelfo
trfiladelfo / index.html
Created July 30, 2020 00:50
Microsoft Homepage Clone
<div class="menu-btn">
<i class="fas fa-bars fa-2x"></i>
</div>
<div class="container">
<!-- Nav -->
<nav class="main-nav">
<img src="https://i.ibb.co/wwLhz98/logo.png" alt="Microsoft" class="logo">
<ul class="main-menu">
@trfiladelfo
trfiladelfo / How to completely uninstall vscode on mac
Last active July 21, 2020 02:20
Backup all extensions install in VS Code
Here are all the places where VSCode stores stuff on Mac OS X, besides the Visual Studio Code.app itself, which is in your Applications folder:
rm -fr ~/Library/Preferences/com.microsoft.VSCode.helper.plist
rm -fr ~/Library/Preferences/com.microsoft.VSCode.plist
rm -fr ~/Library/Caches/com.microsoft.VSCode
rm -fr ~/Library/Caches/com.microsoft.VSCode.ShipIt/
rm -fr ~/Library/Application\ Support/Code/
rm -fr ~/Library/Saved\ Application\ State/com.microsoft.VSCode.savedState/
rm -fr ~/.vscode/
Update (Feb 2020): There are potentially also hidden extension directories in your home directories. To get rid of everything make sure you look for those too. They start with .vscode-.
@trfiladelfo
trfiladelfo / dependencies.txt
Created July 6, 2020 16:26
utilizando datas e timezone em javascript
moment.min.js
moment-timezone-with-data-2010-2020.min.js