Skip to content

Instantly share code, notes, and snippets.

View ferdiaz93's full-sized avatar
馃帶
Working from home

Fernando Diaz ferdiaz93

馃帶
Working from home
View GitHub Profile
@periplox
periplox / validateCuitCuil.js
Last active April 19, 2022 18:40
Funci贸n de JS para validaci贸n de CUIT/CUIL (Argentina)
function validateCuitCuil(num) {
const multipliers = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2, 1];
const validPrefixes = [20, 23, 24, 27, 30, 33, 34];
const digits = num.toString().split('');
const prefix = parseInt(digits[0]+digits[1]);
if (digits.length != 11 || !validPrefixes.includes(prefix)) return false;
const reduction = digits.reduce((carry, value, index) => {
return carry + (value * multipliers[index])
@fidelisrafael
fidelisrafael / app.js
Last active August 26, 2021 02:15
Easy way to export data to XLS format using Node.js
// clone this gist to a empty folder, the run:
// npm init (and follow steps)
// npm install express --save
// npm install swig --save
// node app.js and open http://localhost:3000
function App() {
var express = require('express');