<commit_before><html> 
	<head>
		<script src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script>
		<script src = './plib.js'></script>
		<script src = './lib/browsercouch/browser-couch.js'></script>
		<style type = "text/css">
body{padding:0; margin:0;}		
		</style>
		
		<script type="text/javascript">

$(function(){
	var vec = plib.v2, 
		screen = $("#draw")[0],
		ctx = screen.getContext('2d'),
		draw = false;
		prev = [0,0];
		mousepos = [0,0];
		
		
	screen.width = document.body.clientWidth;
	screen.height = document.body.clientHeight;

	
	//Background
	ctx.fillStyle = "#fff";
	ctx.fillRect (0, 0, screen.width, screen.height);
	ctx.strokeStyle = "#000";
	ctx.globalCompositeOperation = 'darker';
	
	var drawDot = function(pos, rad){
		ctx.fillStyle = "#000";
		ctx.beginPath();
		ctx.arc(pos[0],pos[1], rad,0, 2*Math.PI, true);
		ctx.fill();
		};
	var drawLine = function(s,f){
		ctx.strokeStyle = "#eee";
		ctx.beginPath()
		ctx.moveTo(s[0],s[1]);  
		ctx.lineTo(f[0],f[1]);
		ctx.closePath()
		ctx.stroke()
		
		};
	
	
	//setInterval(function(){}, 20);
	
	var db = BrowserCouch('blank-canvas', {
		storage: BrowserCouch.LocalStorage.isAvailable ? new BrowserCouch.LocalStorage(): new BrowserCouch.FakeStorage()});
		
		
	db.onload(function(){
		var i = 0;
		
		db.view({
			map : function(doc, emit){
				if (doc){
					emit(doc._id, doc);
				}	
			},
			finished : function(view){
				$.each(view.rows, function(){
					drawDot(this.value.pos, this.value.rad || 1);
				});
				i = view.rows.length;
				
				var store = function(pos, rad){
					db.put({_id: 'dot-' + i, pos:pos, rad:rad})
					i++;
				};
				
				$('#draw').mousemove(function(e){
					prev = mousepos;
					mousepos = [event.pageX, event.pageY];
					//console.log(mousepos, draw);
					if (draw){
						var rad = Math.sqrt(vec.len(vec.sub(prev, mousepos)));
						//drawDot(mousepos, rad);
						store(mousepos, rad);
						var t = rad *10;
						db.view({
							map : function(doc, emit){
								if (vec.len(vec.sub(doc.pos, mousepos)) <= t){
									emit (doc._id, doc);
								}	
							},
							finished : function(view){
								for (r in view.rows){
									drawLine(mousepos, view.rows[r].value.pos);
								}
							
							}
							
						});
						
					}	
				}).mousedown(function(){draw=true}).mouseup(function(){draw=false});
			}
		});
	});			
});
		</script>

	</head>
	<body>
		<canvas width = '900' height='500' id = 'draw' ></canvas>
	</body>
</html> 	<commit_msg>Wipe button<commit_after><html> 
	<head>
		<script src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script>
		<script src = './plib.js'></script>
		<script src = './lib/browsercouch/browser-couch.js'></script>
		<style type = "text/css">
body{padding:0; margin:0;}		
		</style>
		
		<script type="text/javascript">

$(function(){
	var vec = plib.v2, 
		screen = $("#draw")[0],
		ctx = screen.getContext('2d'),
		draw = false;
		prev = [0,0];
		mousepos = [0,0];
		
		
	screen.width = document.body.clientWidth;
	screen.height = document.body.clientHeight;

	
	//Background
	ctx.fillStyle = "#fff";
	ctx.fillRect (0, 0, screen.width, screen.height);
	ctx.strokeStyle = "#000";
	ctx.globalCompositeOperation = 'darker';
	
	var drawDot = function(pos, rad){
		ctx.fillStyle = "#000";
		ctx.beginPath();
		ctx.arc(pos[0],pos[1], rad,0, 2*Math.PI, true);
		ctx.fill();
		};
	var drawLine = function(s,f){
		ctx.strokeStyle = "#eee";
		ctx.beginPath()
		ctx.moveTo(s[0],s[1]);  
		ctx.lineTo(f[0],f[1]);
		ctx.closePath()
		ctx.stroke()
		
		};
	
	
	//setInterval(function(){}, 20);
	
	var db = BrowserCouch('blank-canvas', {
		storage: BrowserCouch.LocalStorage.isAvailable ? new BrowserCouch.LocalStorage(): new BrowserCouch.FakeStorage()});
		
		
	db.onload(function(){
		var i = 0;
		
		db.view({
			map : function(doc, emit){
				if (doc){
					emit(doc._id, doc);
				}	
			},
			finished : function(view){
				$.each(view.rows, function(){
					drawDot(this.value.pos, this.value.rad || 1);
				});
				i = view.rows.length;
				
				var store = function(pos, rad){
					db.put({_id: 'dot-' + i, pos:pos, rad:rad})
					i++;
				};
				
				$('#wipe').click(function(){
					ctx.fillStyle = "#fff";
					ctx.globalCompositeOperation = 'source-over';
					ctx.fillRect (0, 0, screen.width, screen.height);
					ctx.globalCompositeOperation = 'darker';
					db.wipe();
				});
				
				$('#draw').mousemove(function(e){
					prev = mousepos;
					mousepos = [event.pageX, event.pageY];
					//console.log(mousepos, draw);
					if (draw){
						var rad = Math.sqrt(vec.len(vec.sub(prev, mousepos)));
						//drawDot(mousepos, rad);
						store(mousepos, rad);
						var t = rad *10;
						db.view({
							map : function(doc, emit){
								if (vec.len(vec.sub(doc.pos, mousepos)) <= t){
									emit (doc._id, doc);
								}	
							},
							finished : function(view){
								for (r in view.rows){
									drawLine(mousepos, view.rows[r].value.pos);
								}
							
							}
							
						});
						
					}	
				}).mousedown(function(){draw=true}).mouseup(function(){draw=false});
			}
		});
	});			
});
		</script>

	</head>
	<body>
		<canvas width = '900' height='500' id = 'draw' ></canvas>
		<button id = "wipe" >Wipe</button>
	</body>
</html> 	
{'fraction_non_alphanumeric': 0.1991669822037107, 'fraction_numerical': 0.01552442256720939, 'mean_word_length': 2.6535269709543567, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 41, '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': '718407', 'n_tokens_mistral': 2522, 'n_tokens_neox': 1931, 'n_words': 352}