diff --git a/apps/Paint/README.md b/apps/Paint/README.md new file mode 100644 index 0000000..ba53437 --- /dev/null +++ b/apps/Paint/README.md @@ -0,0 +1,27 @@ +HTML5Paint +========== + +A simple paint application created using HTML5, JavaScript, NodeJS as the backend and runs on Cloud Foundry. + +The application is currently deployed at [SimplePaint.cloudfoundry.com](http://simplepaint.cloudfoundry.com/). + +Description +------- + +This simple paint application allows a user to draw images or colour in images. The user can clear the canvas to start over and they can also save the image. Below is a screenshot of the application. + +![A screenshot of SimplePaint](http://db.tt/iCjwlJ2Z) + + +Technologies +------- + +The application was developed using Bootstrap, HTML5, ExpressJS, NodeJS, Jade, JavaScript and jQuery. + +Author +------- + +**Shane Doyle** + ++ http://twitter.com/elwexicano ++ http://github.com/ElWexicano diff --git a/apps/Paint/app.js b/apps/Paint/app.js new file mode 100644 index 0000000..83643f9 --- /dev/null +++ b/apps/Paint/app.js @@ -0,0 +1,14 @@ +/* + Application File + Author : Shane Doyle + Date : 31/10/2012 + This file is used to run the application. +*/ +var express = require("express"); +var app = module.exports = express(); + +var config = require("./config.js")(app, express); + +require("./routes/routes")(app); + +app.listen(3000); diff --git a/apps/Paint/config.js b/apps/Paint/config.js new file mode 100644 index 0000000..69e23ee --- /dev/null +++ b/apps/Paint/config.js @@ -0,0 +1,50 @@ +/* + Configuration File + Author : Shane Doyle + Date : 31/10/2012 + This file is used to store the configuration + settings for the application. +*/ +module.exports = function(app, express){ + var config = this; + + app.configure(function(){ + app.set("views", __dirname + "/views"); + app.set("view engine", "jade"); + app.use(express.bodyParser()); + app.use(express.methodOverride()); + app.use(app.router); + app.use(express.static(__dirname + "/public")); + }); + + app.use(NotFoundErrorHandler); + app.use(ErrorHandler); + + // Error Handling - Not Found + function NotFound(msg) { + this.name = "NotFound"; + Error.call(this, msg); + Error.captureStackTrace(this, arguments.callee); + } + + // Error Handling - 404 Error + function NotFoundErrorHandler(err, req, res, next) { + if (error instanceof NotFound) { + res.render("404.jade", { + status: 400 + }); + } else { + next(error); + } + } + + // Error Handling - 500 Error + function ErrorHandler(err, req, res, next) { + res.render("500.jade", { + status: 500, + locals: {error: err} + }); + } + + return config; +}; diff --git a/apps/Paint/img/batman-thumbnail.gif b/apps/Paint/img/batman-thumbnail.gif new file mode 100644 index 0000000..587e658 Binary files /dev/null and b/apps/Paint/img/batman-thumbnail.gif differ diff --git a/apps/Paint/img/batman.gif b/apps/Paint/img/batman.gif new file mode 100644 index 0000000..42fc9a9 Binary files /dev/null and b/apps/Paint/img/batman.gif differ diff --git a/apps/Paint/img/blank-thumbnail.gif b/apps/Paint/img/blank-thumbnail.gif new file mode 100644 index 0000000..c629f79 Binary files /dev/null and b/apps/Paint/img/blank-thumbnail.gif differ diff --git a/apps/Paint/img/chrome.gif b/apps/Paint/img/chrome.gif new file mode 100644 index 0000000..0fe2244 Binary files /dev/null and b/apps/Paint/img/chrome.gif differ diff --git a/apps/Paint/img/firefox.gif b/apps/Paint/img/firefox.gif new file mode 100644 index 0000000..ac22820 Binary files /dev/null and b/apps/Paint/img/firefox.gif differ diff --git a/apps/Paint/img/glyphicons-halflings-white.png b/apps/Paint/img/glyphicons-halflings-white.png new file mode 100644 index 0000000..3bf6484 Binary files /dev/null and b/apps/Paint/img/glyphicons-halflings-white.png differ diff --git a/apps/Paint/img/glyphicons-halflings.png b/apps/Paint/img/glyphicons-halflings.png new file mode 100644 index 0000000..a996999 Binary files /dev/null and b/apps/Paint/img/glyphicons-halflings.png differ diff --git a/apps/Paint/img/ie.gif b/apps/Paint/img/ie.gif new file mode 100644 index 0000000..4ae7713 Binary files /dev/null and b/apps/Paint/img/ie.gif differ diff --git a/apps/Paint/img/opera.gif b/apps/Paint/img/opera.gif new file mode 100644 index 0000000..0a48c3d Binary files /dev/null and b/apps/Paint/img/opera.gif differ diff --git a/apps/Paint/img/safari.gif b/apps/Paint/img/safari.gif new file mode 100644 index 0000000..23a913e Binary files /dev/null and b/apps/Paint/img/safari.gif differ diff --git a/apps/Paint/img/spiderman-thumbnail.gif b/apps/Paint/img/spiderman-thumbnail.gif new file mode 100644 index 0000000..9dc83d9 Binary files /dev/null and b/apps/Paint/img/spiderman-thumbnail.gif differ diff --git a/apps/Paint/img/spiderman.gif b/apps/Paint/img/spiderman.gif new file mode 100644 index 0000000..2dc31bf Binary files /dev/null and b/apps/Paint/img/spiderman.gif differ diff --git a/apps/Paint/index.html b/apps/Paint/index.html new file mode 100644 index 0000000..e165972 --- /dev/null +++ b/apps/Paint/index.html @@ -0,0 +1,100 @@ + + + + + Paint + + + + + + +
+ + + + + + + + +
+ + + + + + + diff --git a/apps/Paint/out.png b/apps/Paint/out.png new file mode 100644 index 0000000..9a5cf18 Binary files /dev/null and b/apps/Paint/out.png differ diff --git a/apps/Paint/package.json b/apps/Paint/package.json new file mode 100644 index 0000000..defbd82 --- /dev/null +++ b/apps/Paint/package.json @@ -0,0 +1,14 @@ +{ + "name": "simple-paint", + "version": "0.0.1", + "private": "true", + "author": "Shane Doyle", + "repository": { + "type": "git", + "url": "https://github.com/iamshanedoyle/html5paint" + }, + "dependencies": { + "express": "", + "jade": "" + } +} diff --git a/apps/Paint/public/img/batman-thumbnail.gif b/apps/Paint/public/img/batman-thumbnail.gif new file mode 100644 index 0000000..587e658 Binary files /dev/null and b/apps/Paint/public/img/batman-thumbnail.gif differ diff --git a/apps/Paint/public/img/batman.gif b/apps/Paint/public/img/batman.gif new file mode 100644 index 0000000..42fc9a9 Binary files /dev/null and b/apps/Paint/public/img/batman.gif differ diff --git a/apps/Paint/public/img/blank-thumbnail.gif b/apps/Paint/public/img/blank-thumbnail.gif new file mode 100644 index 0000000..c629f79 Binary files /dev/null and b/apps/Paint/public/img/blank-thumbnail.gif differ diff --git a/apps/Paint/public/img/chrome.gif b/apps/Paint/public/img/chrome.gif new file mode 100644 index 0000000..0fe2244 Binary files /dev/null and b/apps/Paint/public/img/chrome.gif differ diff --git a/apps/Paint/public/img/firefox.gif b/apps/Paint/public/img/firefox.gif new file mode 100644 index 0000000..ac22820 Binary files /dev/null and b/apps/Paint/public/img/firefox.gif differ diff --git a/apps/Paint/public/img/glyphicons-halflings-white.png b/apps/Paint/public/img/glyphicons-halflings-white.png new file mode 100644 index 0000000..3bf6484 Binary files /dev/null and b/apps/Paint/public/img/glyphicons-halflings-white.png differ diff --git a/apps/Paint/public/img/glyphicons-halflings.png b/apps/Paint/public/img/glyphicons-halflings.png new file mode 100644 index 0000000..a996999 Binary files /dev/null and b/apps/Paint/public/img/glyphicons-halflings.png differ diff --git a/apps/Paint/public/img/ie.gif b/apps/Paint/public/img/ie.gif new file mode 100644 index 0000000..4ae7713 Binary files /dev/null and b/apps/Paint/public/img/ie.gif differ diff --git a/apps/Paint/public/img/opera.gif b/apps/Paint/public/img/opera.gif new file mode 100644 index 0000000..0a48c3d Binary files /dev/null and b/apps/Paint/public/img/opera.gif differ diff --git a/apps/Paint/public/img/safari.gif b/apps/Paint/public/img/safari.gif new file mode 100644 index 0000000..23a913e Binary files /dev/null and b/apps/Paint/public/img/safari.gif differ diff --git a/apps/Paint/public/img/spiderman-thumbnail.gif b/apps/Paint/public/img/spiderman-thumbnail.gif new file mode 100644 index 0000000..9dc83d9 Binary files /dev/null and b/apps/Paint/public/img/spiderman-thumbnail.gif differ diff --git a/apps/Paint/public/img/spiderman.gif b/apps/Paint/public/img/spiderman.gif new file mode 100644 index 0000000..2dc31bf Binary files /dev/null and b/apps/Paint/public/img/spiderman.gif differ diff --git a/apps/Paint/public/javascripts/bootstrap.js b/apps/Paint/public/javascripts/bootstrap.js new file mode 100644 index 0000000..1e3a967 --- /dev/null +++ b/apps/Paint/public/javascripts/bootstrap.js @@ -0,0 +1,2038 @@ +/* =================================================== + * bootstrap-transition.js v2.1.1 + * http://twitter.github.com/bootstrap/javascript.html#transitions + * =================================================== + * Copyright 2012 Twitter, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================================================== */ + + +!function ($) { + + $(function () { + + "use strict"; // jshint ;_; + + + /* CSS TRANSITION SUPPORT (http://www.modernizr.com/) + * ======================================================= */ + + $.support.transition = (function () { + + var transitionEnd = (function () { + + var el = document.createElement('bootstrap') + , transEndEventNames = { + 'WebkitTransition' : 'webkitTransitionEnd' + , 'MozTransition' : 'transitionend' + , 'OTransition' : 'oTransitionEnd otransitionend' + , 'transition' : 'transitionend' + } + , name + + for (name in transEndEventNames){ + if (el.style[name] !== undefined) { + return transEndEventNames[name] + } + } + + }()) + + return transitionEnd && { + end: transitionEnd + } + + })() + + }) + +}(window.jQuery); +/* ========================================================= + * bootstrap-modal.js v2.1.1 + * http://twitter.github.com/bootstrap/javascript.html#modals + * ========================================================= + * Copyright 2012 Twitter, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================================================= */ + + +!function ($) { + + "use strict"; // jshint ;_; + + + /* MODAL CLASS DEFINITION + * ====================== */ + + var Modal = function (element, options) { + this.options = options + this.$element = $(element) + .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) + this.options.remote && this.$element.find('.modal-body').load(this.options.remote) + } + + Modal.prototype = { + + constructor: Modal + + , toggle: function () { + return this[!this.isShown ? 'show' : 'hide']() + } + + , show: function () { + var that = this + , e = $.Event('show') + + this.$element.trigger(e) + + if (this.isShown || e.isDefaultPrevented()) return + + $('body').addClass('modal-open') + + this.isShown = true + + this.escape() + + this.backdrop(function () { + var transition = $.support.transition && that.$element.hasClass('fade') + + if (!that.$element.parent().length) { + that.$element.appendTo(document.body) //don't move modals dom position + } + + that.$element + .show() + + if (transition) { + that.$element[0].offsetWidth // force reflow + } + + that.$element + .addClass('in') + .attr('aria-hidden', false) + .focus() + + that.enforceFocus() + + transition ? + that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) : + that.$element.trigger('shown') + + }) + } + + , hide: function (e) { + e && e.preventDefault() + + var that = this + + e = $.Event('hide') + + this.$element.trigger(e) + + if (!this.isShown || e.isDefaultPrevented()) return + + this.isShown = false + + $('body').removeClass('modal-open') + + this.escape() + + $(document).off('focusin.modal') + + this.$element + .removeClass('in') + .attr('aria-hidden', true) + + $.support.transition && this.$element.hasClass('fade') ? + this.hideWithTransition() : + this.hideModal() + } + + , enforceFocus: function () { + var that = this + $(document).on('focusin.modal', function (e) { + if (that.$element[0] !== e.target && !that.$element.has(e.target).length) { + that.$element.focus() + } + }) + } + + , escape: function () { + var that = this + if (this.isShown && this.options.keyboard) { + this.$element.on('keyup.dismiss.modal', function ( e ) { + e.which == 27 && that.hide() + }) + } else if (!this.isShown) { + this.$element.off('keyup.dismiss.modal') + } + } + + , hideWithTransition: function () { + var that = this + , timeout = setTimeout(function () { + that.$element.off($.support.transition.end) + that.hideModal() + }, 500) + + this.$element.one($.support.transition.end, function () { + clearTimeout(timeout) + that.hideModal() + }) + } + + , hideModal: function (that) { + this.$element + .hide() + .trigger('hidden') + + this.backdrop() + } + + , removeBackdrop: function () { + this.$backdrop.remove() + this.$backdrop = null + } + + , backdrop: function (callback) { + var that = this + , animate = this.$element.hasClass('fade') ? 'fade' : '' + + if (this.isShown && this.options.backdrop) { + var doAnimate = $.support.transition && animate + + this.$backdrop = $('