<commit_before>Thimble on Node.js
==================

This is a port of Thimble, the mozilla webmaker tool for writing and editing
HTML and CSS right in your browser (https://thimble.webmaker.org) from its
Playdoh-embedded python implementation to a dedicated ust-Thimble Node.js
implementation.

While the python implementation relied on Bleach for sanitization, no such
module exists (satisfactorily) for Node.js, so this version relies on a
RESTful Bleach endpoint; the code for this endpoint can be found at:

```
https://github.com/pomax/htmlsanitizer.org
```

The Thimble port and its custom Bleach endpoint are dev-deployed at
http://calm-headland-1764.herokuapp.com and http://peaceful-crag-3591.herokuapp.com,
respectively.

Setup
-----

In order to run Thimble, the following things are required:

1) you will need to have node installed
2) you'll need to fork and then clone the repo recursively:

```
git clone git@github.com:[yourname]/thimble.webmaker.org.git --recursive
```

3) you'll also need to clone the custom sanitization REST service that Thimble uses:

```
git clone git://github.com/Pomax/htmlsanitizer.org.git
```
(this is a version of htmlsanitizer.org with a modified Bleach that can deal with
full documents, rather than document fragments)

4) go into the thimble.webmaker.org dir and run ```npm install```

5) as an optional step, when you don't want to test with a live AWS-S3 instance, you
can set up fake-s3 to handle the S3 publication:

```
gem install fakes3
mkdir fakes3
```

(**note** this requires ```ruby```. If you do not have this installed, visit http://ruby-lang.org)

6) set up the environment variables (see next section).

You are now ready to run the app, by first starting up the sanitizer in the
htmlsanitizer.org directory, by running ```python app.py```

In additional, launch the fake S3 service in a terminal with:

```
fakes3 -r ./fakes3 -h localhost -p 6060 
```

You can then run Thimble from the thimble.webmaker.org directory using
```node app``` or, if you want to run it in continuous mode so that it
auto-restarts when files are updated, ```forever -w app```

Environment variables
---------------------

there is a special file that is used for environment variables in lieu of
actually setting these for development purposes. The base file is
```env.dist``` and is self documented. Simply run through it and set your
values accordingly. To use these values during development, copy this
file:

```
cp env.dist .env
```

and the Thimble code will pick up on it when run through node.

**NOTE** If you are using fakes3, you will need to make sure that
[bucket].localhost points to localhost, which most likely requires
you to add the following rule to your hosts file:

```
127.0.0.1 bucketName.localhost
```

If your bucket name is "test", then this rule should point to
test.localhost, if your bucket name is "potato", point to potato.localhost,
etc.

Note that this file is used on all conventional operation systems, but
lives in different places:

* on *n*x, it is located at ```<systemroot>/etc/hosts```
* on OSX, it is located at ```<systemroot>/private/etc/hosts```
* on Windows, it is located at ```<systemroot>\system32\drivers\etc\hosts```

Development additionals
-----------------------

We handle JS, HTML and CSS linting through grunt, which is very simple
to set up if you don't have it installed already:

```npm install -g grunt-cli```<commit_msg>small readme fix<commit_after>Thimble on Node.js
==================

This is a port of Thimble, the mozilla webmaker tool for writing and editing
HTML and CSS right in your browser (https://thimble.webmaker.org) from its
Playdoh-embedded python implementation to a dedicated ust-Thimble Node.js
implementation.

While the python implementation relied on Bleach for sanitization, no such
module exists (satisfactorily) for Node.js, so this version relies on a
RESTful Bleach endpoint; the code for this endpoint can be found at:

```
https://github.com/pomax/htmlsanitizer.org
```

The Thimble port and its custom Bleach endpoint are dev-deployed at
http://calm-headland-1764.herokuapp.com and http://peaceful-crag-3591.herokuapp.com,
respectively.

Setup
-----

In order to run Thimble, the following things are required:

1) you will need to have node installed
2) you'll need to fork and then clone the repo recursively:

```
git clone <EMAIL>:[yourname]/thimble.webmaker.org.git --recursive
```

3) you'll also need to clone the custom sanitization REST service that Thimble uses:

```
git clone git://github.com/Pomax/htmlsanitizer.org.git
```
(this is a version of htmlsanitizer.org with a modified Bleach that can deal with
full documents, rather than document fragments)

4) go into the thimble.webmaker.org dir and run ```npm install```

5) as an optional step, when you don't want to test with a live AWS-S3 instance, you
can set up fake-s3 to handle the S3 publication:

```
gem install fakes3
mkdir fakes3
```

**NOTE:** this requires ```ruby```. If you do not have this installed, visit http://ruby-lang.org

6) set up the environment variables (see next section).

You are now ready to run the app, by first starting up the sanitizer in the
htmlsanitizer.org directory, by running ```python app.py```

In additional, launch the fake S3 service in a terminal with:

```
fakes3 -r ./fakes3 -h localhost -p 6060 
```

You can then run Thimble from the thimble.webmaker.org directory using
```node app``` or, if you want to run it in continuous mode so that it
auto-restarts when files are updated, ```forever -w app```

Environment variables
---------------------

there is a special file that is used for environment variables in lieu of
actually setting these for development purposes. The base file is
```env.dist``` and is self documented. Simply run through it and set your
values accordingly. To use these values during development, copy this
file:

```
cp env.dist .env
```

and the Thimble code will pick up on it when run through node.

**NOTE:** If you are using fakes3, you will need to make sure that
[bucket].localhost points to localhost, which most likely requires
you to add the following rule to your hosts file:

```
127.0.0.1 bucketName.localhost
```

If your bucket name is "test", then this rule should point to
test.localhost, if your bucket name is "potato", point to potato.localhost,
etc.

Note that this file is used on all conventional operation systems, but
lives in different places:

* on *n*x, it is located at ```<systemroot>/etc/hosts```
* on OSX, it is located at ```<systemroot>/private/etc/hosts```
* on Windows, it is located at ```<systemroot>\system32\drivers\etc\hosts```

Development additionals
-----------------------

We handle JS, HTML and CSS linting through grunt, which is very simple
to set up if you don't have it installed already:

```npm install -g grunt-cli```
{'fraction_non_alphanumeric': 0.1042031523642732, 'fraction_numerical': 0.010215995329830706, 'mean_word_length': 4.083827893175074, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 3, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '551579', 'n_tokens_mistral': 2089, 'n_tokens_neox': 1955, 'n_words': 961}