*I suspect (or hope, at least) there was also an elevator for ADA compliance.
---
I've been back into playing with code some more this week. CodeFights was a fun find, and another little thing I did was put together a word count utility on JSFiddle using AngularJS. Having the word count utility put together essentially helps me avoid keeping OpenOffice Writer open just to assess whether I've hit my goal word count. Considering that I do most of this writing from a Vista machine that I haven't yet scrapped for Ubuntu, this saves me a lot of memory management lag on stupidly low-resource hardware. The HTML and JavaScript for my little word count utility are listed below for your code-reading pleasure...and because I'm sandbagging on my word count again today!
The HTML:
<div ng-app ng-controller="WCController">
<div>Word count: {{ wordCount() }}</div>
<textarea ng-model="words" rows="20" cols="40"/>
</div>
The JavaScript:
function WCController($scope) {
$scope.wordCount = function () {
var text = $scope.words;
var s = text ? text.split(/\s+/) : 0; // it splits the text on space/tab/enter
return s ? s.length : 0;
};
}
No comments:
Post a Comment