Permalink
Browse files

Initial RegExr.com source.

  • Loading branch information...
1 parent e80f30b commit 8de7df87866b4d22faa0a57759767764adce5c3a @wdamien wdamien committed Mar 31, 2014
Showing with 15,479 additions and 3 deletions.
  1. +2 −0 .gitattributes
  2. +30 −0 .gitignore
  3. +10 −0 .htaccess
  4. +191 −0 Gruntfile.js
  5. +1 −1 LICENSE
  6. +52 −2 README.md
  7. BIN assets/ZeroClipboard.swf
  8. BIN assets/regexr-icons.eot
  9. +33 −0 assets/regexr-icons.svg
  10. BIN assets/regexr-icons.ttf
  11. BIN assets/regexr-icons.woff
  12. BIN assets/windows8/largetile.png
  13. BIN assets/windows8/mediumtile.png
  14. BIN assets/windows8/smalltile.png
  15. BIN assets/windows8/widetile.png
  16. 0 css/.gitkeep
  17. +348 −0 index.html
  18. +46 −0 js/BrowserHistory.js
  19. +135 −0 js/ExpressionHighlighter.js
  20. +73 −0 js/ExpressionHover.js
  21. +333 −0 js/RegExLexer.js
  22. +95 −0 js/Settings.js
  23. +111 −0 js/SourceHighlighter.js
  24. +80 −0 js/SubstLexer.js
  25. +43 −0 js/Tracking.js
  26. +214 −0 js/controls/List.js
  27. +134 −0 js/controls/Rating.js
  28. +235 −0 js/controls/TagInput.js
  29. +230 −0 js/controls/Tooltip.js
  30. +533 −0 js/documentation.js
  31. +254 −0 js/events/Event.js
  32. +398 −0 js/events/EventDispatcher.js
  33. +119 −0 js/events/TransitionEvents.js
  34. +171 −0 js/index.template.js
  35. +36 −0 js/net/CommunityModel.js
  36. +103 −0 js/net/ExpressionModel.js
  37. +161 −0 js/net/ServerModel.js
  38. +63 −0 js/net/TagsModel.js
  39. +1,010 −0 js/third-party/ZeroClipboard.js
  40. +176 −0 js/third-party/classList.js
  41. +5,946 −0 js/third-party/codemirror.js
  42. +2 −0 js/third-party/placeholders.min.js
  43. +1 −0 js/third-party/promise-0.1.1.js
  44. +167 −0 js/third-party/store.js
  45. +79 −0 js/utils/CMUtils.js
  46. +165 −0 js/utils/Docs.js
  47. +32 −0 js/utils/TextUtils.js
  48. +305 −0 js/utils/Utils.js
  49. +113 −0 js/views/Community.js
  50. +538 −0 js/views/DocView.js
  51. +318 −0 js/views/Favorites.js
  52. +76 −0 js/views/FlagsMenu.js
  53. +214 −0 js/views/LibView.js
  54. +281 −0 js/views/SaveMenu.js
  55. +228 −0 js/views/ShareMenu.js
  56. +16 −0 package.json
  57. BIN regexrFavicon.ico
  58. +41 −0 scripts.json
  59. +20 −0 scss/codemirror.scss
  60. +109 −0 scss/menus.scss
  61. +40 −0 scss/regexr.scss
  62. +48 −0 scss/settings.scss
  63. +184 −0 scss/shared.scss
  64. +43 −0 scss/site.scss
  65. +20 −0 scss/tagList.scss
  66. +59 −0 scss/tags.scss
  67. +263 −0 scss/third-party/codemirror.scss
  68. +47 −0 scss/tooltips.scss
  69. +38 −0 scss/utilities.scss
  70. +188 −0 scss/views/community.scss
  71. +71 −0 scss/views/docView.scss
  72. +53 −0 scss/views/header.scss
  73. +267 −0 scss/views/libView.scss
  74. +87 −0 tasks/watchSass.js
View
@@ -0,0 +1,2 @@
+* text eol=lf
+*.ico binary
View
@@ -0,0 +1,30 @@
+#-----------------------------
+# SYSTEM
+#-----------------------------
+.DS_Store
+
+#-----------------------------
+# INVALID FILES
+# (for cross OS compatibility)
+#-----------------------------
+*[\<\>\:\"\/\\\|\?\*]*
+
+#-----------------------------
+# WORKSPACE
+#-----------------------------
+.idea/
+*.sublime-project
+*.sublime-workspace
+
+#-----------------------------
+# BUILD/DEBUGGING
+#-----------------------------
+node_modules/
+.sass-cache/
+build/
+
+#-----------------------------
+# PROJECT SPECIFIC
+#-----------------------------
+_db.php
+regexr.css
View
@@ -0,0 +1,10 @@
+RewriteEngine on
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteRule . / [L]
+
+# BEGIN GZIP
+<ifmodule mod_deflate.c>
+AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
+</ifmodule>
+# END GZIP
View
@@ -0,0 +1,191 @@
+var path = require("path");
+var uglify = require('uglify-js');
+
+var folderMount = function folderMount(connect, point) {
+ return connect.static(path.resolve(point));
+};
+
+module.exports = function (grunt) {
+
+ grunt.initConfig({
+ pkg: grunt.file.readJSON("package.json"),
+ deployFolder: 'build/',
+
+ 'min': {
+ options: {
+ report: false
+ },
+ 'build': {
+ 'src': getScripts().app,
+ 'dest': '<%= deployFolder %>js/scripts.min.js'
+ }
+ },
+
+ sass: {
+ build:{
+ options: {
+ compass: true,
+ style: 'compact', // Can be nested, compact, compressed, expanded
+ precision: 2,
+ },
+ files: {
+ "css/regexr.css":"scss/regexr.scss"
+ }
+ }
+ },
+
+ watchSass: {
+ run: {
+ options: {
+ compass: true,
+ // In prep-tasks, we change the style for a build, to compressed;
+ style: "nested", // Can be nested, compact, compressed, expanded
+ "line-numbers": true,
+ precision: 2,
+ },
+ files: {
+ "css/regexr.css":"scss/regexr.scss"
+ }
+ }
+ },
+
+ 'cssmin': {
+ options: {
+ report: false
+ },
+ 'build': {
+ 'src': "css/regexr.css",
+ 'dest': '<%= deployFolder %>css/regexr.css'
+ }
+ },
+
+ copy: {
+ build: {
+ files: [
+ {
+ expand: true,
+ src:[
+ 'assets/**',
+ 'php/**',
+ '*.ico',
+ '.htaccess',
+ 'manifest.json'
+ ],
+ dest: "<%= deployFolder %>"
+ }
+ ]
+ }
+ },
+
+ connect: {
+ build: {
+ options: {
+ hostname: '*',
+ keepalive:true,
+ middleware: function (connect, options) {
+ return [folderMount(connect, grunt.config.get("deployFolder"))]
+ }
+ }
+ }
+ },
+
+ htmlmin: {
+ options: {
+ removeComments: true,
+ collapseWhitespace: true
+ },
+ build: {
+ files:[{src: '<%= deployFolder %>index.html.tmp', dest: '<%= deployFolder %>index.html'}],
+ }
+ },
+
+ clean: {
+ build: ["<%= deployFolder %>!(v1|.git|php)**"],
+ postBuild: ["<%= deployFolder %>**/*.tmp"]
+ }
+ });
+
+ /**
+ * Loads our scripts.json file.
+ *
+ */
+ function getScripts() {
+ var scripts = grunt.file.readJSON('scripts.json');
+ var missing = [];
+ for (var n in scripts) {
+ var arr = scripts[n];
+ arr.forEach(function(item, index, array) {
+ if (!grunt.file.exists(item)) {
+ missing.push(n+': '+item);
+ }
+ });
+ }
+
+ if (missing.length) {
+ // \x07 == beep sound in the terminal.
+ grunt.log.warn('\x07Missing ', missing.length + ' scripts.\n\t' + missing.join('\n\t'));
+ }
+
+ return scripts;
+ }
+
+ /**
+ * Utility function.
+ * Returns an minified version of a javascript string, file or files.
+ *
+ * @param script {String|Array} Either a Javascript string,
+ * or an array of paths to Javascript files.
+ *
+ * Returns a minified version of the script(s) passed in.
+ */
+ function minifyJS(script) {
+ var uglifyConfig = {};
+ if (typeof script == "string") {
+ uglifyConfig.fromString = true;
+ }
+
+ var result = uglify.minify(script, uglifyConfig);
+ return result.code;
+ }
+
+ /**
+ * Runs the index.html file through grunts template system.
+ *
+ */
+ grunt.registerTask("parse-index", function (type) {
+ var templateFile = grunt.file.read("index.html");
+ var indexJs = minifyJS(grunt.file.read("js/index.template.js"));
+ var buildIndexTag = "<script>"+indexJs+"</script>";
+
+ var output = grunt.template.process(templateFile, {data:{build:true, index:buildIndexTag, noCache:Date.now()}})
+
+ //Write a temp html file, the htmlmin task will minify it to index.html
+ grunt.file.write(grunt.config.get("deployFolder")+"index.html.tmp", output);
+ });
+
+ grunt.registerTask("build", [
+ "clean:build",
+ "sass",
+ "cssmin",
+ "min",
+ "parse-index",
+ "htmlmin",
+ "copy",
+ "clean:postBuild",
+ "connect:build"
+ ]);
+
+ /*
+ Load all the tasks we need
+ Usually we use uglifyJS for code minification.
+ However uglify breaks the Unicode characters Codemirror uses in its RegEx expressions,
+ whereas yui does not.
+ */
+ grunt.loadNpmTasks("grunt-yui-compressor");
+ grunt.loadNpmTasks("grunt-contrib-sass");
+ grunt.loadNpmTasks("grunt-contrib-connect");
+ grunt.loadNpmTasks('grunt-contrib-clean');
+ grunt.loadNpmTasks('grunt-contrib-htmlmin');
+ grunt.loadNpmTasks('grunt-contrib-copy');
+ grunt.loadTasks('tasks/');
+};
View
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
+SOFTWARE.
View
@@ -1,8 +1,58 @@
RegExr
======
+# About
+This is the source for [RegExr.com](http://regexr.com/)
RegExr is a HTML/JS based tool for creating, testing, and learning about Regular Expressions.
-It launched on Mar 26, 2014 at [RegExr.com](http://regexr.com/)
+# Build
+## RegExr uses [Grunt](http://gruntjs.com/) to manage the build process.
-We are going to take a bit of time to clean up and organize the code before releasing it here. Until then this repo will be used to track bugs and feedback.
+## To use
+
+Note that this requires a familiarity with using the command line.
+The example commands shown are for use with the OSX Terminal.
+
+### Install dependencies
+
+Node (0.10.24 or greater is required):
+
+ # check the version via the command line
+ node -v
+
+If your Node install is out of date, get the latest from [NodeJS.org](http://nodejs.org/)
+
+After node is setup, install the other dependencies. You may want to familiarize yourself with the Node Packager Manager (NPM) before proceeding.
+
+ # Install the grunt command line utility globally
+ sudo npm install grunt-cli -g
+
+ # Install all the dependencies from package.json
+ npm install
+
+### Setup
+#### Compile sass
+The only requirement for development is to compile the sass files. This can be achieved manually via ```grunt sass;```
+or for development you can watch for changes use ```grunt watchSass;```
+You can also use any third-party sass compiler. Examples are; Using a WebStorm watcher or CodeKits built compiler.
+
+#### Other setup
+There is no other setup required, grunt build mainly prepares the source for deployment.
+
+### Building
+To prepare the site for a deploy run:
+
+ grunt build;
+
+This command will:
+
+* Copy all required assets to the build/ folder.
+* Combine and minify the *.js files
+* Compile and minify the sass
+* Inject js/index.template.js into the index.html file
+* Minify the index.html file
+
+# Code Style
+If you would like to contribute back to RegExr.com please send us pull requests.
+Please make sure they are well formatted and follow the style specified out in the existing files.
+Mainly just keep your white space as tabs, and all line breaks as \n.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.

0 comments on commit 8de7df8

Please sign in to comment.