Last active
January 24, 2020 11:48
-
-
Save jmgunn87/9882152 to your computer and use it in GitHub Desktop.
optimal recognition point for a word
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* {font-family:monospace} | |
.g { text-align: center; font-size:36px } | |
.v { text-align: center; font-size:36px } | |
.l { margin:0;padding:0;color: black;} | |
.p { margin:0;padding:0;color: red; } | |
.r { margin:0;padding:0;color: black; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="g"></div> | |
<div class="v"></div> | |
<hr> | |
<div class="c"> | |
The UK's Computer Emergency Response Team (CERT-UK), which will co-ordinate the country's cybersecurity defence, has been formally launched. | |
The body will deal with "cybersecurity incidents" of national significance. | |
It will also provide advice and alerts on cyber-threats to government, industry and academia. | |
Speaking at the launch, Cabinet Office Minister Francis Maude said that 93% of large corporations had had "a breach" over the past financial year. | |
The attacks cost on average between £450,000 and £850,000, he added. | |
The minister also repeated the claim that one London-based company had suffered a security breach which cost it "£800m worth of revenue". | |
But, he said, cybersecurity also presented an opportunity. It was "an essential feature of - and a massive opportunity for - the UK's economic recovery". | |
Many countries around the world now have their own CERT, a crucial component in the sharing of information to prevent cyber-attacks. | |
'A milestone' | |
The government says it has allocated £860m to the UK's cybersecurity efforts. | |
However, figures were not available for the current budget specifically for CERT-UK, which will be based in London and will consist of a team of 55 people. | |
According to its website, cert.gov.uk, CERT-UK would issue an alert and appropriate guidance in the exceptional event of a critical national cybersecurity incident. | |
Providing advisory notices of "cybersecurity issues being detected across government, industry or academia" would be another function. | |
However the organisation has no law enforcement role or powers - its primary role is co-ordination and information-sharing. | |
Although CERT-UK had its official launch today, director Chris Gibson, formerly the director of e-crime at global bank Citigroup, was appointed in November and work has been in progress for some months. | |
A particular focus of the organisation will be the protection of companies seen to be part of the critical national infrastructure, such as banks, and power generation and distribution firms. | |
National Grid spokesman Steve Collins described the launch of CERT-UK as a "milestone". | |
It will also provide a single point of contact for co-ordinating international responses to computer security incidents - a move welcomed by other countries' cybersecurity teams. | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function renderGuide() { | |
document.querySelector('.g').innerHTML = [ | |
'<span class="p">|</span>', | |
].join(''); | |
} | |
function renderWord(word) { | |
var split = ORP(word); | |
var length = word.length; | |
var lpad = rpad = ''; | |
if (length == 2) { | |
rpad = pad(" ", 1); | |
} else if (length == 1 || length == 3) { | |
rpad = pad(" ", 0); | |
} else if (length % 2) { | |
lpad = pad(" ", Math.floor(length / 2) - split + 1); | |
} else { | |
lpad = pad(" ", Math.floor(length / 2) - split); | |
} | |
document.querySelector('.v').innerHTML = [ | |
'<span class="l">' + lpad + word.substr(0, split) + '</span>', | |
'<span class="p">' + word.substr(split, 1) + '</span>', | |
'<span class="r">' + word.substr(split + 1) + rpad + '</span>' | |
].join(''); | |
} | |
function ORP(word){ | |
var length = word.length; | |
while('\n,.?!:;"'.indexOf(word[--length]) !== -1); | |
switch(++length) { | |
case 0: case 1: return 0; | |
case 2: case 3: return 1; | |
default: return Math.floor(length / 2) - 1; | |
} | |
} | |
function pad(string, count) { | |
var result = ''; | |
while (count--) result += string; | |
return result; | |
} | |
renderGuide(); | |
var words = document.querySelector(".c").innerHTML.split(' '); | |
var iid = setInterval(function () { | |
if (!words.length) return clearInterval(iid); | |
renderWord(words.shift()); | |
}, 120); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment