Permalink
Browse files

adding three options for boilerplates

  • Loading branch information...
1 parent 7704358 commit 8d812825db1fa88ffac4ad1fc8a01559eb67db5b @addyosmani addyosmani committed Dec 25, 2011
Showing with 40,904 additions and 0 deletions.
  1. +28 −0 README.md
  2. +89 −0 option1/app.js
  3. +5 −0 option1/install.sh
  4. +38 −0 option1/public/404.html
  5. +25 −0 option1/public/crossdomain.xml
  6. +444 −0 option1/public/css/style.css
  7. BIN option1/public/favicon.ico
  8. +43 −0 option1/public/humans.txt
  9. +2 −0 option1/public/img/.gitignore
  10. BIN option1/public/img/destroy.png
  11. +8,981 −0 option1/public/js/libs/jquery-1.6.2.js
  12. +18 −0 option1/public/js/libs/jquery-1.6.2.min.js
  13. +4 −0 option1/public/js/libs/modernizr-2.0.6.min.js
  14. +2 −0 option1/public/js/mylibs/.gitignore
  15. +33 −0 option1/public/js/mylibs/backbone-min.js
  16. +1,158 −0 option1/public/js/mylibs/backbone.js
  17. +29 −0 option1/public/js/mylibs/underscore-min.js
  18. +931 −0 option1/public/js/mylibs/underscore.js
  19. +5 −0 option1/public/js/plugins.js
  20. +235 −0 option1/public/js/script.js
  21. +5 −0 option1/public/robots.txt
  22. +107 −0 option1/public/static.html
  23. +31 −0 option1/public/test/index.html
  24. +148 −0 option1/public/test/qunit/qunit.css
  25. +1,265 −0 option1/public/test/qunit/qunit.js
  26. +27 −0 option1/public/test/tests.js
  27. +89 −0 option2/app.js
  28. +5 −0 option2/install.sh
  29. +38 −0 option2/public/404.html
  30. +25 −0 option2/public/crossdomain.xml
  31. +444 −0 option2/public/css/style.css
  32. BIN option2/public/favicon.ico
  33. +43 −0 option2/public/humans.txt
  34. +2 −0 option2/public/img/.gitignore
  35. BIN option2/public/img/destroy.png
  36. +8,981 −0 option2/public/js/libs/jquery-1.6.2.js
  37. +18 −0 option2/public/js/libs/jquery-1.6.2.min.js
  38. +4 −0 option2/public/js/libs/modernizr-2.0.6.min.js
  39. +2 −0 option2/public/js/mylibs/.gitignore
  40. +33 −0 option2/public/js/mylibs/backbone-min.js
  41. +1,158 −0 option2/public/js/mylibs/backbone.js
  42. +29 −0 option2/public/js/mylibs/underscore-min.js
  43. +931 −0 option2/public/js/mylibs/underscore.js
  44. +5 −0 option2/public/js/plugins.js
  45. +235 −0 option2/public/js/script.js
  46. +5 −0 option2/public/robots.txt
  47. +31 −0 option2/public/test/index.html
  48. +148 −0 option2/public/test/qunit/qunit.css
  49. +1,265 −0 option2/public/test/qunit/qunit.js
  50. +27 −0 option2/public/test/tests.js
  51. +52 −0 option2/views/layout.jade
  52. +41 −0 option2/views/todo.jade
  53. +7 −0 option3/Gemfile
  54. +75 −0 option3/README.md
  55. +38 −0 option3/app.rb
  56. +5 −0 option3/install.sh
  57. +38 −0 option3/public/404.html
  58. +25 −0 option3/public/crossdomain.xml
  59. +444 −0 option3/public/css/style.css
  60. BIN option3/public/favicon.ico
  61. +43 −0 option3/public/humans.txt
  62. +2 −0 option3/public/img/.gitignore
  63. BIN option3/public/img/destroy.png
  64. +8,981 −0 option3/public/js/libs/jquery-1.6.2.js
  65. +18 −0 option3/public/js/libs/jquery-1.6.2.min.js
  66. +4 −0 option3/public/js/libs/modernizr-2.0.6.min.js
  67. +2 −0 option3/public/js/mylibs/.gitignore
  68. +33 −0 option3/public/js/mylibs/backbone-min.js
  69. +1,158 −0 option3/public/js/mylibs/backbone.js
  70. +29 −0 option3/public/js/mylibs/underscore-min.js
  71. +931 −0 option3/public/js/mylibs/underscore.js
  72. +5 −0 option3/public/js/plugins.js
  73. +235 −0 option3/public/js/script.js
  74. +5 −0 option3/public/robots.txt
  75. +31 −0 option3/public/test/index.html
  76. +148 −0 option3/public/test/qunit/qunit.css
  77. +1,265 −0 option3/public/test/qunit/qunit.js
  78. +27 −0 option3/public/test/tests.js
  79. +1 −0 option3/views/index.haml
  80. +48 −0 option3/views/layout.haml
  81. +42 −0 option3/views/todo.haml
View
@@ -1,2 +1,30 @@
Another work in progress.
+Todo application boilerplates demonstrating:
+
+Option 1
+=========
+* Backbone
+* Node.js
+* Express
+* Mongoose
+* MongoDB
+
+Option 2
+=========
+* Backbone
+* Jade
+* Node.js
+* Express
+* Mongoose
+* MongoDB
+
+Option 3
+==========
+* Backbone
+* Haml
+* Ruby
+* Sinatra
+* MongoDB
+
+Instructions to come soon.
View
@@ -0,0 +1,89 @@
+var application_root = __dirname,
+ express = require("express"),
+ path = require("path"),
+ mongoose = require('mongoose');
+
+var app = express.createServer();
+
+// model
+mongoose.connect('mongodb://localhost/my_database');
+
+var Todo = mongoose.model('Todo', new mongoose.Schema({
+ text: String,
+ done: Boolean,
+ order: Number
+}));
+
+app.configure(function(){
+ app.use(express.bodyParser());
+ app.use(express.methodOverride());
+ app.use(app.router);
+ app.use(express.static(path.join(application_root, "public")));
+ app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
+ app.set('views', path.join(application_root, "views"));
+ app.set('view engine', 'jade')
+});
+
+app.get('/', function(req, res){
+ res.send('Hello World');
+});
+
+app.get('/todo', function(req, res){
+ res.render('todo', {title: "MongoDB Backed TODO App"});
+});
+
+app.get('/api/todos', function(req, res){
+ return Todo.find(function(err, todos) {
+ return res.send(todos);
+ });
+});
+
+app.get('/api/todos/:id', function(req, res){
+ return Todo.findById(req.params.id, function(err, todo) {
+ if (!err) {
+ return res.send(todo);
+ }
+ });
+});
+
+app.put('/api/todos/:id', function(req, res){
+ return Todo.findById(req.params.id, function(err, todo) {
+ todo.text = req.body.text;
+ todo.done = req.body.done;
+ todo.order = req.body.order;
+ return todo.save(function(err) {
+ if (!err) {
+ console.log("updated");
+ }
+ return res.send(todo);
+ });
+ });
+});
+
+app.post('/api/todos', function(req, res){
+ var todo;
+ todo = new Todo({
+ text: req.body.text,
+ done: req.body.done,
+ order: req.body.order
+ });
+ todo.save(function(err) {
+ if (!err) {
+ return console.log("created");
+ }
+ });
+ return res.send(todo);
+});
+
+app.delete('/api/todos/:id', function(req, res){
+ return Todo.findById(req.params.id, function(err, todo) {
+ return todo.remove(function(err) {
+ if (!err) {
+ console.log("removed");
+ return res.send('')
+ }
+ });
+ });
+});
+
+app.listen(3000);
View
@@ -0,0 +1,5 @@
+#!/bin/bash
+npm install express
+npm install mongodb --mongodb:native
+npm install mongoose
+npm install jade
View
@@ -0,0 +1,38 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Page Not Found :(</title>
+ <style>
+ body { text-align: center;}
+ h1 { font-size: 50px; text-align: center }
+ span[frown] { transform: rotate(90deg); display:inline-block; color: #bbb; }
+ body { font: 20px Constantia, 'Hoefler Text', "Adobe Caslon Pro", Baskerville, Georgia, Times, serif; color: #999; text-shadow: 2px 2px 2px rgba(200, 200, 200, 0.5); }
+ ::-moz-selection{ background:#FF5E99; color:#fff; }
+ ::selection { background:#FF5E99; color:#fff; }
+ article {display:block; text-align: left; width: 500px; margin: 0 auto; }
+
+ a { color: rgb(36, 109, 56); text-decoration:none; }
+ a:hover { color: rgb(96, 73, 141) ; text-shadow: 2px 2px 2px rgba(36, 109, 56, 0.5); }
+ </style>
+</head>
+<body>
+ <article>
+ <h1>Not found <span frown>:(</span></h1>
+ <div>
+ <p>Sorry, but the page you were trying to view does not exist.</p>
+ <p>It looks like this was the result of either:</p>
+ <ul>
+ <li>a mistyped address</li>
+ <li>an out-of-date link</li>
+ </ul>
+ </div>
+
+ <script>
+ var GOOG_FIXURL_LANG = (navigator.language || '').slice(0,2),
+ GOOG_FIXURL_SITE = location.host;
+ </script>
+ <script src="http://linkhelp.clients.google.com/tbproxy/lh/wm/fixurl.js"></script>
+ </article>
+</body>
+</html>
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
+<cross-domain-policy>
+
+
+<!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->
+
+<!-- Most restrictive policy: -->
+ <site-control permitted-cross-domain-policies="none"/>
+
+
+
+<!-- Least restrictive policy: -->
+<!--
+ <site-control permitted-cross-domain-policies="all"/>
+ <allow-access-from domain="*" to-ports="*" secure="false"/>
+ <allow-http-request-headers-from domain="*" headers="*" secure="false"/>
+-->
+<!--
+ If you host a crossdomain.xml file with allow-access-from domain="*"
+ and don’t understand all of the points described here, you probably
+ have a nasty security vulnerability. ~ simon willison
+-->
+
+</cross-domain-policy>
Oops, something went wrong.

0 comments on commit 8d81282

Please sign in to comment.