<commit_before># labelcraft ( Hackathon edition )

### Duplicating Repo  

You will need [Git][git] to make a duplicate of this repository. 

Make a bare clone of the repository  
	% git clone --bare https://github.com/GridIron/hackathon.git

Mirror-push to your new repository  
	% cd hackathon.git  
	% git push --mirror https://github.com/your-username/your-new-repo.git

Remove our temporary local repository  
	% cd ..  
	% rm -rf hackathon.git 

Now you can make a clone of your new repo  
	% git clone https://github.com/your-username/your-new-repo.git 



### Build the Front End
move to the www directory (your-repo-name/www)


	% sudo apt-get update && sudo apt-get install -y npm nodejs

	% gpg --keyserver hkp://keys.gnupg.net --recv-keys <KEY>

Install rvm
	% \curl -sSL -k https://get.rvm.io | bash -s stable --rails

	
Install ruby 2.2.2
	% rvm install ruby-2.2.2

Check ruby version
	% ruby -v
If anything other than 2.2.2 use
	% rvm use 2.2.2
If getting rvm is not a funtion error, follow the instructions [here][rvm]


	% sudo apt-get install ruby-dev
	% sudo ln -s /usr/bin/nodejs /usr/bin/node

	Make git replace the protocol for you (Fixes firewall issue)
	% git config --global url."https://".insteadOf git://

	% sudo npm install -g bower
	% sudo npm install -g grunt

	% bower install
	% bower install grunt-cli

	% sudo npm install
	% sudo npm install -g grunt-cli
	% gem install compass
	
serve front-end
	% grunt serve		
		-If running ubuntu on EC2, a change will need to be made in the Gruntfile. On line 84 change 'localhost' to '0.0.0.0', keeping the quotes

###Build Database
Go to the 
	% sudo apt-get update -y && \
  	sudo apt-get install -y postgresql postgresql-contrib

Add to /api/config/databade.yml 
  development: &default
  adapter: postgresql
  database: ads_development
  encoding: utf8
  host: localhost
  min_messages: warning
  pool: 2
  timeout: 5000
  username: postgres 						*add this line
  password:									*add this line

Modify /etc/postgresql/9.3/main/pg_hba.conf file to look like below (at bottom of file)

	# Database administrative login by Unix domain socket
	local   all             postgres                                peer

	# TYPE  DATABASE        USER            ADDRESS                 METHOD

	# "local" is for Unix domain socket connections only
	local   all             all                                     trust
	# IPv4 local connections:
	host    all             all             127.0.0.1/32            trust
	# IPv6 local connections:
	host    all             all             ::1/128                 trust

Then go into the psql terminal as postgres user
	% sudo -u postgres psql
Then type the following command to refresh
	% select pg_reload_conf();
	% \q

Now move to the api directory (your-repo-name/api)
Then create and migrate the database
	% sudo apt-get install rake
	% sudo gem install bundler
	% gem install rails 
	% sudo apt-get install libpq-dev
	% bundle install
  	% rake db:create
  	% rake db:migrate
	% rails s
		-If running ubuntu on EC2, use  `rails s -b 0.0.0.0 -p 3000`

[git]: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
[rvm]: https://rvm.io/integration/gnome-terminal
<commit_msg>format<commit_after># labelcraft ( Hackathon edition )

### Duplicating Repo  

You will need [Git][git] to make a duplicate of this repository. 

Make a bare clone of the repository  
	% git clone --bare https://github.com/GridIron/hackathon.git

Mirror-push to your new repository  
	% cd hackathon.git  
	% git push --mirror https://github.com/your-username/your-new-repo.git

Remove our temporary local repository  
	% cd ..  
	% rm -rf hackathon.git 

Now you can make a clone of your new repo  
	% git clone https://github.com/your-username/your-new-repo.git 



### Build the Front End
move to the www directory (your-repo-name/www) and run the following commands

	% sudo apt-get update && sudo apt-get install -y npm nodejs

	% gpg --keyserver hkp://keys.gnupg.net --recv-keys <KEY>

Install rvm  

	% \curl -sSL -k https://get.rvm.io | bash -s stable --rails

	
Install ruby 2.2.2  

	% rvm install ruby-2.2.2

Check ruby version  

	% ruby -v

If anything other than 2.2.2 use  

	% rvm use 2.2.2

If getting rvm is not a funtion error, follow the instructions [here][rvm]

Continue running the following commands

	% sudo apt-get install ruby-dev
	% sudo ln -s /usr/bin/nodejs /usr/bin/node

	Make git replace the protocol for you (Fixes firewall issue)
	% git config --global url."https://".insteadOf git://

	% sudo npm install -g bower
	% sudo npm install -g grunt

	% bower install
	% bower install grunt-cli

	% sudo npm install
	% sudo npm install -g grunt-cli
	% gem install compass
	
serve front-end  

	% grunt serve	

		**If running ubuntu on EC2, a change will need to be made in the Gruntfile. On line 84 change 'localhost' to '0.0.0.0', keeping the quotes**

###Build Database

	% sudo apt-get update -y && \
  	sudo apt-get install -y postgresql postgresql-contrib

Add to /api/config/databade.yml  

  development: &default  
  adapter: postgresql  
  database: ads_development  
  encoding: utf8  
  host: localhost  
  min_messages: warning  
  pool: 2  
  timeout: 5000  
  username: postgres 						*add this line  
  password:									*add this line  

Modify /etc/postgresql/9.3/main/pg_hba.conf file to look like below (at bottom of file)  

	# Database administrative login by Unix domain socket
	local   all             postgres                                peer

	# TYPE  DATABASE        USER            ADDRESS                 METHOD

	# "local" is for Unix domain socket connections only
	local   all             all                                     trust
	# IPv4 local connections:
	host    all             all             127.0.0.1/32            trust
	# IPv6 local connections:
	host    all             all             ::1/128                 trust

Then go into the psql terminal as postgres user  

	% sudo -u postgres psql

Then type the following command to refresh  

	% select pg_reload_conf();
	% \q

Now move to the api directory (your-repo-name/api) and run the following commands  

	% sudo apt-get install rake
	% sudo gem install bundler
	% gem install rails 
	% sudo apt-get install libpq-dev
	% bundle install

Then create and migrate the database  
  	% rake db:create
  	% rake db:migrate

 Run the api  
	% rails s
		
		-If running ubuntu on EC2, use  `rails s -b 0.0.0.0 -p 3000`

[git]: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
[rvm]: https://rvm.io/integration/gnome-terminal

{'fraction_non_alphanumeric': 0.08574474565945782, 'fraction_numerical': 0.015534572037770332, 'mean_word_length': 2.3694202154951256, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 14, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5463065', 'n_tokens_mistral': 2304, 'n_tokens_neox': 2052, 'n_words': 773}