Skip to content

Instantly share code, notes, and snippets.

View dannyverp's full-sized avatar
👋

Danny Verpoort dannyverp

👋
View GitHub Profile
@dannyverp
dannyverp / main.tf
Created March 18, 2021 20:36
Cheap k8s cluster Terraform
provider "google" {
project = "<project>"
region = "us-central1"
}
data "google_client_config" "default" {}
provider "kubernetes" {
load_config_file = false
host = "https://${module.gke.endpoint}"
<?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;
<?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 December 5, 2018 15:30
Diacritics removal
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',