Skip to content

Instantly share code, notes, and snippets.

View franklinbaldo's full-sized avatar

Franklin Silveira Baldo franklinbaldo

  • Procuradoria Geral do Estado de Rondônia
  • Porto Velho, Rondônia
  • X @franklinbaldo
View GitHub Profile

Keybase proof

I hereby claim:

  • I am franklinbaldo on github.
  • I am franklinbaldo (https://keybase.io/franklinbaldo) on keybase.
  • I have a public key whose fingerprint is A362 99FC CB1B F7AF B55B 0171 F8B9 CDF7 83FA F7D7

To claim this, I am signing this object:

Verifying that "franklinbaldo.id" is my Blockstack ID. https://onename.com/franklinbaldo
@franklinbaldo
franklinbaldo / gist:49d0c1710eee916db5417ddfa0887426
Last active June 16, 2017 02:04
FORMULA PARA VALIDAR CNPJ NO GOOGLE SPREESHET

cnpj

=AND(text(mod(sum(ARRAYFORMULA(ARRAYFORMULA(right(left(A2;{1;2;3;4;5;6;7;8;9;10;11;12});1)){6;7;8;9;2;3;4;5;6;7;8;9}));11);"0")=text(right(left(A2;13);1);"0");RIGHT(text(mod(sum(ARRAYFORMULA(ARRAYFORMULA(right(left(A2;{1;2;3;4;5;6;7;8;9;10;11;12;13});1)){5;6;7;8;9;2;3;4;5;6;7;8;9}));11);"0");1)=text(right(A2;1);"0"))

cpf

=AND(RIGHT(TEXT(mod(SUM(ARRAYFORMULA(ARRAYFORMULA(RIGHT(LEFT(A4;{1;2;3;4;5;6;7;8;9});1))*{10;9;8;7;6;5;4;3;2}))10;11);"0");1)&RIGHT(TEXT(mod(SUM(ARRAYFORMULA(ARRAYFORMULA(RIGHT(LEFT(A4;{1;2;3;4;5;6;7;8;9;10});1)){11;10;9;8;7;6;5;4;3;2}))*10;11);"0");1)=right(A4;2);ARRAYFORMULA(AND({1;2;3;4;5;6;7;8;9;10;11}*11111111111<>A4)))

0x501A75d969796b027bf808e880F6487b109310e7
function setup(form1ID) {
var scriptProperties = PropertiesService.getScriptProperties();
var form3ID = scriptProperties.getProperty("form3ID");
if (form3ID == null) {
var form3 = FormApp.create('Form3 - Colects Edit URL from form ' + form1ID);
var itemTimestamp = form3.addTextItem()
.setTitle("Timestamp");
var itemEditUrlLong = form3.addTextItem()
.setTitle("EditUrlLong");
var itemEditUrlShort = form3.addTextItem()
@franklinbaldo
franklinbaldo / export-to-csv.gs
Last active April 26, 2020 16:14 — forked from mderazon/export-to-csv.gs
Google apps script to export to individual csv files all sheets in an open spreadsheet
function myFunction() {
var ss = SpreadsheetApp.getActive();
var sheet = ss.getSheetByName("orange");
var range = sheet.getRange("1:1").getValues();
var titles = range[0];
var a1range = "A1:A";
var a1array = [];
a1range = a1range +titles.length*titles.length;
var b1range = "B1:B";
function validarCPFouCNPJ (valor){
valor = String(valor).replace(/[^0-9]/g,"").padStart("0",14).substr(0,14);
let cnpj = valor.split("");
let cpf = valor.substr(-11).split("");
let mascaras={};
mascaras.cnpj = [6,5,4,3,2,9,8,7,6,5,4,3,2];
mascaras.cpf = [11,10,9,8,7,6,5,4,3,2];
let validar = function (cpfcnpj){
let tipo = (cpfcnpj.length>11)?"cnpj":"cpf";
let dv = cpfcnpj.slice(-2);
@franklinbaldo
franklinbaldo / google-form-to-github-issue.md
Created September 22, 2018 22:38 — forked from bmcbride/google-form-to-github-issue.md
Create a new GitHub Issue from a Google Form submission

Wiring up a Google Form to GitHub is not that difficult with a little bit of Apps Script automation. All you need is a Google account, a GitHub account, and a web browser...

Set up your GitHub Personal Access Token

Personal access tokens provide an easy way to interact with the GitHub API without having to mess with OAuth. If you don't already have a personal access token with repo or public_repo access, visit your GitHub settings page and generate a new token.

Be sure to copy your token some place safe and keep it secure. Once generated, you will not be able to view or copy the token again.

Set up the Form & Spreadsheet

  1. Create a Google Form.
<!DOCTYPE html>
<meta charset="utf-8">
<title>SANKEY Experiment</title>
<style>
.node rect {
cursor: move;
fill-opacity: .9;
shape-rendering: crispEdges;
}