Skip to content

Instantly share code, notes, and snippets.

View agodin3z's full-sized avatar
🍻
Working hard~

Andrés Godínez agodin3z

🍻
Working hard~
View GitHub Profile
@agodin3z
agodin3z / Luhn.js
Created November 17, 2020 02:27 — forked from jscari/Luhn.js
Luhn algorithm - generate / validate
var Luhn = {
// length of our number (check digit included)
length: 10,
pow2: [0, 2, 4, 6, 8, 1, 3, 5, 7, 9],
// compute check digit
checksum: function (x) {
var sum = 0;
var n;
var odd = false;
for (var i = x.length - 1; i >= 0; --i) {
@agodin3z
agodin3z / sequelize-migration-file-generator.js
Last active June 16, 2023 08:13 — forked from manuelbieh/sequelize-migration-file-generator.js
Creates migration files for existing sequelize models [custom]
#!/usr/bin/env node
const fs = require('fs');
const models = require('../models');
for (const model in models) {
const tableName = models[model].tableName;
let defaultValue = '';
let onUpdate = '';