<commit_before><html>
<head>
	<title>outter</title>
</head>
<body>
<table width="100%">
	<tr>
		<td width="50%" height="100%">
			<textarea id="input"></textarea>
		</td>
		<td width="50%">
			<textarea id="output"></textarea>
		</td>
	</tr>
	<tr>
		<td height="0" colspan="2"><input id="cmd" value="php /Users/jdonat/Projects/donatj/misstep/parse.php" /></td>
	</tr>
</table>
<script type="text/javascript">
	var gui = require('nw.gui');
	win = gui.Window.get();
	var nativeMenuBar = new gui.Menu({type: "menubar"});

	try {
		nativeMenuBar.createMacBuiltin("My App");
		win.menu = nativeMenuBar;
	} catch(ex) {
		console.log(ex.message);
	}

	var input = document.getElementById('input');
	var output = document.getElementById('output');
	var cmd = document.getElementById('cmd');

	var timeout;
	input.addEventListener('keyup', function() {
		var that = this;
		var cmdData = cmd.value.split(' ');

		console.log(cmdData);
		clearTimeout(timeout);

		function draw() {
			var spawnSync = require('child_process').spawnSync;
			var result = spawnSync(cmdData.shift(), cmdData, {input: that.value});
			console.log(result);
			console.log(that.value);
			output.value = result.stdout;
		}

		timeout = setTimeout(draw, 300);
	})
</script>

<style>
	html, body {
		padding: 0;
		margin: 0;
		height: 100%;
		background: #ececec;
	}

	table {
		height: 100%;
	}

	#cmd {
		width: 100%;
	}

	#input, #output {
		width: 100%;
		height: 100%;
	}

	textarea, input {
		font-size: 14px;
		font-family: Source Code Pro;
	}
</style>
</body>
</html><commit_msg>Lots of basic functionality.<commit_after><html>
<head>
	<title>Standard Otter</title>
</head>
<body>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td width="50%" height="100%">
			<textarea id="input"></textarea>
		</td>
		<td width="50%">
			<textarea id="output" readonly></textarea>
		</td>
	</tr>
	<tr>
		<td height="0" colspan="2">
			<input id="cmd" />
		</td>
	</tr>
</table>
<script type="text/javascript">
	"use strict";
	var app = {
		'title': 'Standard Otter'
	};
	var gui = require('nw.gui');
	window.win = gui.Window.get();
	var nativeMenuBar = new gui.Menu({type: "menubar"});

	var insertAtCursor = function( myField, myValue ) {
		if( myField.selectionStart || myField.selectionStart == '0' ) {
			var startPos = myField.selectionStart;
			var endPos = myField.selectionEnd;
			myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
			myField.selectionEnd = myField.selectionStart = startPos + myValue.length;
		} else {
			console.log('wtf');
			myField.value += myValue;
		}
	};

	try {
		nativeMenuBar.createMacBuiltin("My App");
		win.menu = nativeMenuBar;
	} catch(ex) {
		console.log(ex.message);
	}

	var input = document.getElementById('input');
	var output = document.getElementById('output');
	var cmd = document.getElementById('cmd');

	cmd.value = localStorage.cmd || 'cat';

	input.addEventListener('keydown', function( e ) {
		if( e.keyCode == 9 ) {

			e.preventDefault();
			insertAtCursor(input, "\t");
		}
	});

	var timeout;
	input.addEventListener('keyup', function() {
		var that = this;
		var cmdData = cmd.value.split(' ').filter(function( x ) { return x != '' });
		

		clearTimeout(timeout);

		function draw() {
			var spawnSync = require('child_process').spawnSync;
			var result = spawnSync(cmdData.shift(), cmdData, {input: that.value});

			output.value = result.stdout;

			console.log(result);

			if( result.status == 0 ) {
				output.style.background = '';
				document.title = app.title;
			} else {
				output.style.background = '#ffeeee';
				document.title = app.title + ' - Exit Code: ' + result.status;
			}
		}

		timeout = setTimeout(draw, 300);
	});

	cmd.addEventListener('change', function() {
		localStorage.cmd = cmd.value;
	});
</script>

<style scoped>
	html, body {
		padding: 0;
		margin: 0;
		height: 100%;
		background: #ececec;
	}

	table {
		height: 100%;
	}

	#cmd {
		width: 100%;
	}

	#input, #output {
		width: 100%;
		height: 100%;
	}

	textarea, input {
		font-size: 14px;
		font-family: Monaco, monospace;

		resize: none;
		outline: none;
	}
</style>
</body>
</html>
{'fraction_non_alphanumeric': 0.18325358851674642, 'fraction_numerical': 0.01770334928229665, 'mean_word_length': 3.7782857142857145, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5119108', 'n_tokens_mistral': 1729, 'n_tokens_neox': 1495, 'n_words': 323}