Skip to content

Instantly share code, notes, and snippets.

Avatar
🇳🇱

Danny Verpoort dannyverp

🇳🇱
View GitHub Profile
@dannyverp
dannyverp / main.tf
Created Mar 18, 2021
Cheap k8s cluster Terraform
View main.tf
provider "google" {
project = "<project>"
region = "us-central1"
}
data "google_client_config" "default" {}
provider "kubernetes" {
load_config_file = false
host = "https://${module.gke.endpoint}"
View complexityExample2.php
<?php
sumOfPrimes(int max): int {
$total = 0;
for (int i = 1; i <= max; ++i) {
for (int j = 2; j < i; ++j) {
if (i % j == 0) {
continue;
}
}
total += i;
View complexityExample.php
<?php
public function getWords(int number): string
{
switch (number) {
case 1:
return "one";
case 2:
return "a couple";
case 3:
return “a few”;
@dannyverp
dannyverp / diacritics.js
Last active Dec 5, 2018
Diacritics removal
View diacritics.js
function removeDiacritics (s) {
if (!removeDiacritics.translate_re) removeDiacritics.translate_re = new RegExp('[' + Object.keys(latinMap).join('') + ']', 'g')
return (s.replace(removeDiacritics.translate_re, function (match) {
return latinMap[match]
}))
}
const latinMap = {
'Á': 'A',
'Ă': 'A',