<commit_before>requirejs.config
	baseUrl: '../'

	shim:
		'underscore':
			exports: '_'

		'jquery':
			exports: '$'

		'socket.io':
			exports: 'io'

		'three':
			exports: 'THREE'

	# We want the following paths for 
	# code-sharing reasons. Now it doesn't 
	# matter from where we require a module.
	paths:
		'public': './'

		'underscore': 'vendor/scripts/underscore'
		'jquery': 'vendor/scripts/jquery'
		'three': 'vendor/scripts/three'
		'stats': 'vendor/scripts/stats.min'
		'socket.io': 'socket.io/socket.io'

require [
	'scripts/app._'
	'library/models/remote.server'

	'three'
	'stats'

	'jquery'
	'underscore'
	], ( App, Server, Three, Stats, $, _ ) ->

	# Inspector app class. This will create and draw a 3d scene
	# containing all nodes and their connections.
	#
	class App.Inspector extends App

		type: 'inspector'
		serverAddress: ':8080/'

		nodes: []
		
		# Constructs a new inspector app. 
		#
		constructor: ( ) ->
			viewAngle = 45
			nearClip = 0.1
			farClip = 10000

			@_zoom = 1
			@_deltaX = 0
			@_deltaY = 0
			@_lastMouseX = 0
			@_lastMouseY = 0
			@_mouseDown = false		

			@_cameraAngle = new Three.Quaternion()

			# Connect to the server.
			@server = new Server(@, @serverAddress)

			# Create container element.
			container = document.createElement 'div'
			container.id = 'container'
			document.body.appendChild(container)

			# Get width and height of the window and determine aspect ratio.
			[width, height] = @setDimensions()
			aspectRatio = width / height

			# Create scene, camera and renderer.
			@scene = new Three.Scene()
			@camera = new Three.PerspectiveCamera(viewAngle, aspectRatio, nearClip, farClip)
			@renderer = new Three.WebGLRenderer()

			@renderer.setSize(width, height)
			container.appendChild(@renderer.domElement)
			@scene.add(@camera)

			# Add lights to the scene.
			hemisphereLight = new THREE.HemisphereLight( 0xffffff, 0xaaaaaa, 1 );
			@scene.add(hemisphereLight)

			# Set the last updated time to 0
			@_lastUpdateTime = 0

			# Various callbacks and the like.
			window.requestAnimationFrame(@update)
			$(window).resize(@setDimensions)
			
			$(window).mousemove ( event ) =>
				if @_mouseDown
					@_deltaX = event.offsetX - @_lastMouseX
					@_deltaY = event.offsetY - @_lastMouseY

					@_lastMouseX = event.offsetX
					@_lastMouseY = event.offsetY

			$(window).mousedown ( ) => 
				@_mouseDown = true
				@_lastMouseX = event.offsetX
				@_lastMouseY = event.offsetY

			$(window).mouseup ( ) => 
				@_mouseDown = false

			$(window).scroll ( event ) =>
				console.log event

			setInterval( =>
				@server.query('nodes', 'node.structured', true, @processNodesInfo)
			, 1000)

		# Sets the dimensions of the viewport and the aspect ration of the camera
		#
		# @return [[Integer, Integer]] a tuple of the width and height of the container
		#
		setDimensions: ( ) =>
			width = window.innerWidth
			height = window.innerHeight

			@renderer?.setSize(width, height)
			@camera?.aspect = width / height
			@camera?.updateProjectionMatrix()

			return [width, height]

		# Updates the scene, calling update on every node in the scene. Also 
		# requests a new animation frame to keep on updating.
		#
		# @param timestamp [Integer] the time that has elapsed since the first update
		#
		update: ( timestamp ) =>
			# Get time since last update and update all nodes.
			dt = (timestamp - @_lastUpdateTime) / 1000
			node.update(dt) for node in @nodes

			# Update camera position.
			if @_mouseDown
				width = window.innerWidth
				height = window.innerHeight

				yAngle = -(@_deltaX / width)  * Math.PI * 5
				zAngle = -(@_deltaY / height) * Math.PI * 5

				angle = new Three.Quaternion().setFromEuler(new Three.Euler(0, yAngle, zAngle, 'YXZ'))
				@_cameraAngle.multiply(angle)

			position = new Three.Vector3(-100 * @_zoom, 0, 0).applyQuaternion(@_cameraAngle)
			@camera.position.lerp(position, dt * 20)
			@camera.lookAt(new Three.Vector3(0, 0, 0))

			zVector = new Three.Vector3(1, 0, 0).applyQuaternion(new Three.Quaternion().setFromEuler(@camera.rotation))
			yVector = @camera.position.clone()
			@camera.up = new Three.Vector3().crossVectors(zVector, yVector).negate()

			# Render the scene.
			@renderer.render(@scene, @camera)

			# Set last update time and request a new animation frame.
			@_lastUpdateTime = timestamp
			window.requestAnimationFrame(@update)
<commit_msg>Don't remove all edges every cycle, but do something a little smarter<commit_after>requirejs.config
	baseUrl: '../'

	shim:
		'underscore':
			exports: '_'

		'jquery':
			exports: '$'

		'socket.io':
			exports: 'io'

		'three':
			exports: 'THREE'

		'stats':
			exports: 'Stats'

	# We want the following paths for 
	# code-sharing reasons. Now it doesn't 
	# matter from where we require a module.
	paths:
		'public': './'

		'underscore': 'vendor/scripts/underscore'
		'jquery': 'vendor/scripts/jquery'
		'three': 'vendor/scripts/three'
		'stats': 'vendor/scripts/stats.min'
		'socket.io': 'socket.io/socket.io'

require [
	'scripts/app._'
	'library/models/remote.server'

	'three'
	'stats'

	'jquery'
	'underscore'
	], ( App, Server, Three, Stats, $, _ ) ->

	console.log Stats


	# Inspector app class. This will create and draw a 3d scene
	# containing all nodes and their connections.
	#
	class App.Inspector extends App

		type: 'inspector'
		serverAddress: ':8080/'

		nodes: []
		
		# Constructs a new inspector app. 
		#
		constructor: ( ) ->
			viewAngle = 45
			nearClip = 0.1
			farClip = 10000

			@_zoom = 1
			@_deltaX = 0
			@_deltaY = 0
			@_lastMouseX = 0
			@_lastMouseY = 0
			@_mouseDown = false		

			@_cameraAngle = new Three.Quaternion()

			# Connect to the server.
			@server = new Server(@, @serverAddress)

			# Create container element.
			container = document.createElement 'div'
			container.id = 'container'
			document.body.appendChild(container)

			# Get width and height of the window and determine aspect ratio.
			[width, height] = @setDimensions()
			aspectRatio = width / height

			# Create scene, camera and renderer.
			@scene = new Three.Scene()
			@camera = new Three.PerspectiveCamera(viewAngle, aspectRatio, nearClip, farClip)
			@renderer = new Three.WebGLRenderer()

			@renderer.setSize(width, height)
			container.appendChild(@renderer.domElement)
			@scene.add(@camera)

			# Add lights to the scene.
			hemisphereLight = new THREE.HemisphereLight( 0xffffff, 0xaaaaaa, 1 );
			@scene.add(hemisphereLight)

			# Set the last updated time to 0
			@_lastUpdateTime = 0

			# Add debug stats
			@stats = new Stats()
			@stats.domElement.style.position = 'absolute'
			@stats.domElement.style.top = '0px'
			@stats.domElement.style.left = '0px'
			container.appendChild(@stats.domElement)

			# Various callbacks and the like.
			window.requestAnimationFrame(@update)
			$(window).resize(@setDimensions)
			
			$(window).mousemove ( event ) =>
				if @_mouseDown
					@_deltaX = event.offsetX - @_lastMouseX
					@_deltaY = event.offsetY - @_lastMouseY

					@_lastMouseX = event.offsetX
					@_lastMouseY = event.offsetY

			$(window).mousedown ( ) => 
				@_mouseDown = true
				@_lastMouseX = event.offsetX
				@_lastMouseY = event.offsetY

			$(window).mouseup ( ) => 
				@_mouseDown = false

			$(window).scroll ( event ) =>
				console.log event

			setInterval( =>
				@server.query('nodes', 'node.structured', true, @processNodesInfo)
			, 1000)

		# Sets the dimensions of the viewport and the aspect ration of the camera
		#
		# @return [[Integer, Integer]] a tuple of the width and height of the container
		#
		setDimensions: ( ) =>
			width = window.innerWidth
			height = window.innerHeight

			@renderer?.setSize(width, height)
			@camera?.aspect = width / height
			@camera?.updateProjectionMatrix()

			return [width, height]

		# Updates the scene, calling update on every node in the scene. Also 
		# requests a new animation frame to keep on updating.
		#
		# @param timestamp [Integer] the time that has elapsed since the first update
		#
		update: ( timestamp ) =>
			# Get time since last update and update all nodes.
			dt = (timestamp - @_lastUpdateTime) / 1000
			node.update(dt) for node in @nodes

			# Update camera position.
			if @_mouseDown
				width = window.innerWidth
				height = window.innerHeight

				yAngle = -(@_deltaX / width)  * Math.PI * 5
				zAngle = -(@_deltaY / height) * Math.PI * 5

				angle = new Three.Quaternion().setFromEuler(new Three.Euler(0, yAngle, zAngle, 'YXZ'))
				@_cameraAngle.multiply(angle)

			position = new Three.Vector3(-100 * @_zoom, 0, 0).applyQuaternion(@_cameraAngle)
			@camera.position.lerp(position, dt * 20)
			@camera.lookAt(new Three.Vector3(0, 0, 0))

			zVector = new Three.Vector3(1, 0, 0).applyQuaternion(new Three.Quaternion().setFromEuler(@camera.rotation))
			yVector = @camera.position.clone()
			@camera.up = new Three.Vector3().crossVectors(zVector, yVector).negate()

			# Render the scene.
			@renderer.render(@scene, @camera)

			# Update stats.
			@stats.update()

			# Set last update time and request a new animation frame.
			@_lastUpdateTime = timestamp
			window.requestAnimationFrame(@update)

{'fraction_non_alphanumeric': 0.1222879684418146, 'fraction_numerical': 0.011615165461319308, 'mean_word_length': 3.276944704779756, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '117712', 'n_tokens_mistral': 3591, 'n_tokens_neox': 2943, 'n_words': 806}