Delphi: HtmlToColor and ColorToHtml

function ColorToHtml(Color: TColor): string;
begin
  Result := IntToHex(Color, 6);
  Result := '#' + Copy(Result, 5, 2) + Copy(Result, 3, 2) + Copy(Result, 1, 2);
end;

function HtmlToColor(Color: string): TColor;
begin
  Result := StringToColor('$' + Copy(Color, 6, 2) + Copy(Color, 4, 2) + Copy(Color, 2, 2));
end;

Detect Browser Version

<script>
function get_browser(){
    var N=navigator.appName, ua=navigator.userAgent, tem;
    var M=ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
    if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
    M=M? [M[1], M[2]]: [N, navigator.appVersion, '-?'];
    return M[0];
    }
function get_browser_version(){
    var N=navigator.appName, ua=navigator.userAgent, tem;
    var M=ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
    if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
    M=M? [M[1], M[2]]: [N, navigator.appVersion, "-?"];
    return M[1];
    }
  document.write(get_browser()+'<br>'+get_browser_version());
</script>

MSIE
7.0

Continue reading “Detect Browser Version”

Straight Quotes and Curly Quotes

DescriptionHTML
Straight single quote
Straight double quote 
Opening single quote&lsquo;
Closing single quote&rsquo;
Opening double quote&ldquo;
Closing double quote&rdquo;

<q>Hello</q> renders as “Hello”. Parent element (like html) must have a lang attribute (like lang=”en”) so the q tag knows what kind of curly quotes to use.

Ensure text remains visible during webfont load

NOTE: Only modern browsers support font-display!

@font-face {
  font-family: 'Pacifico';
  font-style: normal;
  font-weight: 400;
  src: local('Pacifico Regular'), local('Pacifico-Regular'), url(https://fonts.gstatic.com/s/pacifico/v12/FwZY7-Qmy14u9lezJ-6H6MmBp0u-.woff2) format('woff2');
  font-display: swap;
}
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700&display=swap" rel="stylesheet">