Skip to content

Instantly share code, notes, and snippets.

@SeanPlusPlus
Created May 9, 2012 01:07
Show Gist options
  • Save SeanPlusPlus/2640904 to your computer and use it in GitHub Desktop.
Save SeanPlusPlus/2640904 to your computer and use it in GitHub Desktop.
HashSum.html
<html>
<head>
</head>
<body>
<pre></pre>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js"></script>
<script>
var HTML_FILE_URL = 'data.txt';
$(document).ready(function() {
$.get(HTML_FILE_URL, function(data) {
masterArr = data.split('\n');
masterHash = {}
$.each(masterArr, function(index, value) {
counter = 0;
$.each(masterArr, function(i, v) {
if ( value == v ) {
counter += 1;
masterHash[value] = counter;
}
});
});
$.each(masterHash, function(k,v) {
if ( k.length > 0 ) {
$('pre').append( k + ": " + v + "\n");
}
});
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment