Skip to content

Instantly share code, notes, and snippets.

@onnimonni
onnimonni / remove-accents-on-upload.php
Last active February 26, 2018 11:02
Wordpress plugin which sanitizes files on upload. This fixes OS-X NFD characters as well if you have Normalizer class and icu library installed.
<?php
/**
* Plugin Name: Remove accents from files on upload
* Plugin URI: https://gist.github.com/onnimonni/d58bdcff44f8208a15c7
* Description: Sanitize accents from Cyrillic, German, French, Polish, Spanish, Hungarian, Czech, Greek, Swedish during upload. Also fix OS-X NFD filenames.
* Version: 1.0
* Author: Onni Hakala
* Author URI: http://github.com/onnimonni
* License: GPLv3
*/
@nikcorg
nikcorg / hyphenate.js
Last active October 18, 2016 19:08
Finnish hyphenation a la Haiku-editori
// Paraphrased from http://teppo.tv/haikueditori/haikueditori.js
var rVowels = /[aeiouyåäö]/i;
var rConsonants = /[bcdfghjklmnpqrstvwxz]/i;
var rDiphthongs = /(aa|ee|ii|oo|uu|yy|åå|ää|öö|ai|ei|oi|ui|yi|åi|äi|öi|au|eu|iu|ou|äy|öy|ie|uo|yö|ey|iy)/i;
function isVowel(chr) {
return rVowels.test(chr);
}