Skip to content

Instantly share code, notes, and snippets.

@seorefbe
seorefbe / gist:e98bedefd9bbdfe93883cfb6717b651e
Last active January 10, 2022 10:54
Translate yaml with Deepl API
public function translateFile($lang)
{
$handle = fopen("/tmp/fr.yaml", "r");
$myfile = fopen("/tmp/".$lang.".yaml", "w") or die("Unable to open file!");
if ($handle && $myfile) {
while (($line = fgets($handle)) !== false) {
if (substr($line, 0, 1) === '#' || $line === '' || $line === '\r\n' || $line === '\r' || $line === '\n') {
fwrite($myfile, $line);
}
else {
@seorefbe
seorefbe / ExportICS.cls
Last active November 10, 2016 09:51
A script to generate iCalendar (.ics) files on the fly in InterSystem Cache
/*
//my custom toUTC fonction -> convert date to yyyymmddThhiissZ format
//date: YYYY-MM-DD
//hours: 1200 for 12:00
//Z: "Z" or empty
ClassMethod toUTC(date As %String, hours As %String, Z As %String) As %String
{
Quit $replace(date,"-","")_"T"_hours_"00"_$Get(Z,"")
}
*/