Skip to content

Instantly share code, notes, and snippets.

View mathifonseca's full-sized avatar

Mathi Fonseca mathifonseca

View GitHub Profile
@mathifonseca
mathifonseca / BrazilianMobilePhoneValidator.groovy
Last active January 2, 2024 18:19
Brazilian mobile phone validator
/*
Anatel Documentation -> http://www.anatel.gov.br/Portal/exibirPortalPaginaEspecial.do?org.apache.struts.taglib.html.TOKEN=9594e1d11fbc996d52bda44e608bb744&codItemCanal=1794&pastaSelecionada=2984
TL;DR:
Before 2012-07-29, Brazilian mobile phones where 10 digits long, 2 of them being an area code. e.g.: 11 2222-3333
From then on, they are slowly adding a ninth digit between the area code and the user's number, like this: 11 9 2222-3333
This process will end on 2016-12-31, so if you are reading this after that date, ignore the first method and use the second one.
*/
boolean isValidBrazilianMobilePhoneBefore20161231(String phone) {
@mathifonseca
mathifonseca / intro_to_rails
Last active October 17, 2017 17:04
Intro to Rails
#crear app
rails new rottenpotatoes
cd rottenpotatoes
tree
#agregar haml a Gemfile
https://gist.github.com/e858c6b1ba260e9b0ecccdebd64cb2d7
bundle install
#mirar routes vacias
@mathifonseca
mathifonseca / AlfredDemo.md
Last active July 2, 2019 18:35
AlfredDemo

Pay with Cash / Credit Card

  • Shop API-KEY -> EDGDgFU21pZD6VBpJFMX635y5Gh8vyLYiNAmh2Y5qn7Be3wPp2dNFQ9R
  • Platform API-KEY -> ww7Tpkha3jxE6eJgmi74xG89zTWCSh2Pw7wVELC6t7wb6MXE8Bbsjkuj

STEP 1 - Create Purchase

POST /v2/alfred/purchase