Skip to content

Instantly share code, notes, and snippets.

@thegeorgeous
thegeorgeous / LuhnGenerator.java
Created April 13, 2020 19:00
Luhn Number generator
import java.util.Random;
public class LuhnGenerator {
public static String generate(Integer len) {
Random rgen = new Random();
Integer luhnNumber = rgen.nextInt(899999) + 100000;
String code = luhnNumber.toString();
return code + generateCheckSum(code);
}
@thegeorgeous
thegeorgeous / table.js
Created September 23, 2020 11:46
Generating an HTML table from JSON data
// From: https://www.valentinog.com/blog/html-table/
let mountains = [
{ name: "Monte Falco", height: 1658, place: "Parco Foreste Casentinesi" },
{ name: "Monte Falterona", height: 1654, place: "Parco Foreste Casentinesi" },
{ name: "Poggio Scali", height: 1520, place: "Parco Foreste Casentinesi" },
{ name: "Pratomagno", height: 1592, place: "Parco Foreste Casentinesi" },
{ name: "Monte Amiata", height: 1738, place: "Siena" }
];