<commit_before>var headless = require( 'headless' ),
	fs = require( 'fs' ),
	path = require( 'path' ),
	spawn = require( 'child_process' ).spawn,
	argue = {};

argue.firefox = function( br, uri, opts, cb ) {
	var prefs = '';

	opts.options = opts.options || [];

	if ( opts.proxy ) {
		var m = /^(?:http:\/\/)?([^:\/]+)(?::(\d+))?/.exec( opts.proxy ),
			host = JSON.stringify( m[ 1 ] ),
			port = m[ 2 ] || 80;

		prefs += [
			'"network.proxy.http", ' + host,
			'"network.proxy.http_port", ' + port,
			'"network.proxy.type", 1',
			'"browser.cache.disk.capacity", 0',
			'"browser.cache.disk.smart_size.enabled", false',
			'"browser.cache.disk.smart_size.first_run", false',
			'"browser.sessionstore.resume_from_crash", false',
			'"browser.startup.page", 0',
			'"network.proxy.no_proxies_on", ' + JSON.stringify( opts.noProxy || '' )
		].map( function( x ) {
			return 'user_pref(' + x + ');\n';
		} ).join( '' );
	}

	prefs += 'user_pref("browser.shell.checkDefaultBrowser", false);\n';

	var file = path.join( path.dirname( br.profile.file ), 'user.js' );

	fs.writeFile( file, prefs, function( err ) {
		if ( err ) {
			cb( err );
		} else {
			cb( null, opts.options.concat( [
				'--no-remote',
				'-P', br.profile.name,
				uri
			] ) );
		}
	} );
};

argue.ie = function( br, uri, opts, cb ) {
	cb( null, [ uri ] );
};

argue.safari = function( br, uri, opts, cb ) {
	cb( null, [ uri ] );
};

argue.chrome = function( br, uri, opts, cb ) {
	opts.options = opts.options || [];

	cb( null, opts.options.concat( [
		opts.proxy ? '--proxy-server=' + opts.proxy : null,
		br.profile ? '--user-data-dir=' + br.profile : null,
		'--disable-restore-session-state',
		'--no-default-browser-check',
		'--start-maximized',
		'--disable-default-apps',
		'--disable-sync',
		'--enable-fixed-layout',
		'--no-first-run',
		'--noerrdialogs ',
		uri
	] ).filter( Boolean ) );
};

argue.phantom = function( br, uri, opts, cb ) {
	var file = path.join( br.profile, 'phantom.js' ),
		src = 'require(\'webpage\').create().open(' + JSON.stringify( uri ) + ')';

	// `phantomjs uri` would be TOO EASY I guess?
	opts.options = opts.options || [];

	fs.writeFile( file, src, function( err ) {
		if ( err ) {
			cb( err );
		} else {
			cb( null, opts.options.concat( [
				opts.proxy ? '--proxy=' + opts.proxy.replace( /^http:\/\//, '' ) : null,
				file
			] ).filter( Boolean ) );
		}
	} );
};

function copy( src, dest, cb ) {
	var rs = fs.createReadStream( src ),
		ws = fs.createWriteStream( dest ),
		called = false;

	function done( err ) {
		if ( !called ) {
			called = true;
			cb( err );
		}
	}

	rs.on( 'error', done );
	ws.on( 'error', done );
	ws.on( 'close', function() {<commit_msg>Resolved #4 - use static file for PhantomJS.<commit_after>var headless = require( 'headless' ),
	fs = require( 'fs' ),
	path = require( 'path' ),
	spawn = require( 'child_process' ).spawn,
	argue = {};

argue.firefox = function( br, uri, opts, cb ) {
	var prefs = '';

	opts.options = opts.options || [];

	if ( opts.proxy ) {
		var m = /^(?:http:\/\/)?([^:\/]+)(?::(\d+))?/.exec( opts.proxy ),
			host = JSON.stringify( m[ 1 ] ),
			port = m[ 2 ] || 80;

		prefs += [
			'"network.proxy.http", ' + host,
			'"network.proxy.http_port", ' + port,
			'"network.proxy.type", 1',
			'"browser.cache.disk.capacity", 0',
			'"browser.cache.disk.smart_size.enabled", false',
			'"browser.cache.disk.smart_size.first_run", false',
			'"browser.sessionstore.resume_from_crash", false',
			'"browser.startup.page", 0',
			'"network.proxy.no_proxies_on", ' + JSON.stringify( opts.noProxy || '' )
		].map( function( x ) {
			return 'user_pref(' + x + ');\n';
		} ).join( '' );
	}

	prefs += 'user_pref("browser.shell.checkDefaultBrowser", false);\n';

	var file = path.join( path.dirname( br.profile.file ), 'user.js' );

	fs.writeFile( file, prefs, function( err ) {
		if ( err ) {
			cb( err );
		} else {
			cb( null, opts.options.concat( [
				'--no-remote',
				'-P', br.profile.name,
				uri
			] ) );
		}
	} );
};

argue.ie = function( br, uri, opts, cb ) {
	cb( null, [ uri ] );
};

argue.safari = function( br, uri, opts, cb ) {
	cb( null, [ uri ] );
};

argue.chrome = function( br, uri, opts, cb ) {
	opts.options = opts.options || [];

	cb( null, opts.options.concat( [
		opts.proxy ? '--proxy-server=' + opts.proxy : null,
		br.profile ? '--user-data-dir=' + br.profile : null,
		'--disable-restore-session-state',
		'--no-default-browser-check',
		'--start-maximized',
		'--disable-default-apps',
		'--disable-sync',
		'--enable-fixed-layout',
		'--no-first-run',
		'--noerrdialogs ',
		uri
	] ).filter( Boolean ) );
};

argue.phantom = function( br, uri, opts, cb ) {
	var file = path.join( __dirname, '../res/phantom.js' );

	opts.options = opts.options || [];

	cb( null, opts.options.concat( [
		opts.proxy ? '--proxy=' + opts.proxy.replace( /^http:\/\//, '' ) : null,
		file,
		uri
	] ).filter( Boolean ) );
};

function copy( src, dest, cb ) {
	var rs = fs.createReadStream( src ),
		ws = fs.createWriteStream( dest ),
		called = false;

	function done( err ) {
		if ( !called ) {
			called = true;
			cb( err );
		}
	}

	rs.on( 'error', done );
	ws.on( 'error', done );
	ws.on( 'close', function() {
{'fraction_non_alphanumeric': 0.22431704501731436, 'fraction_numerical': 0.0028857252789534437, 'mean_word_length': 2.9060856498873027, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1614107', 'n_tokens_mistral': 2171, 'n_tokens_neox': 1973, 'n_words': 423}