diff --git a/.DS_Store b/.DS_Store index 1d1692c..5ab3b20 100755 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/cd20202/.DS_Store b/cd20202/.DS_Store index 549253a..abe1094 100755 Binary files a/cd20202/.DS_Store and b/cd20202/.DS_Store differ diff --git a/cd20202/ang-weekend-lab/.bowerrc b/cd20202/ang-weekend-lab/.bowerrc new file mode 100644 index 0000000..2de69f2 --- /dev/null +++ b/cd20202/ang-weekend-lab/.bowerrc @@ -0,0 +1,3 @@ +{ + "directory": "public/vendor/" +} \ No newline at end of file diff --git a/cd20202/ang-weekend-lab/.gitignore b/cd20202/ang-weekend-lab/.gitignore new file mode 100644 index 0000000..503442c --- /dev/null +++ b/cd20202/ang-weekend-lab/.gitignore @@ -0,0 +1,2 @@ +node_modules +public/vendor diff --git a/cd20202/ang-weekend-lab/Procfile b/cd20202/ang-weekend-lab/Procfile new file mode 100644 index 0000000..6f86b16 --- /dev/null +++ b/cd20202/ang-weekend-lab/Procfile @@ -0,0 +1 @@ +web: node server.js \ No newline at end of file diff --git a/cd20202/ang-weekend-lab/README.md b/cd20202/ang-weekend-lab/README.md new file mode 100644 index 0000000..9dd3b54 --- /dev/null +++ b/cd20202/ang-weekend-lab/README.md @@ -0,0 +1 @@ +Angular Weekend Lab \ No newline at end of file diff --git a/cd20202/ang-weekend-lab/bower.json b/cd20202/ang-weekend-lab/bower.json new file mode 100644 index 0000000..246f484 --- /dev/null +++ b/cd20202/ang-weekend-lab/bower.json @@ -0,0 +1,13 @@ +{ + "name": "seed-mean-html", + "version": "1.0.0", + "dependencies": { + "angular": "latest", + "angular-ui-router": "~0.2.15", + "angular-resource": "latest", + "angular-sanitize": "latest", + "angular-touch": "latest", + "bootstrap": "latest", + "font-awesome": "latest" + } +} diff --git a/cd20202/ang-weekend-lab/models/post.js b/cd20202/ang-weekend-lab/models/post.js new file mode 100644 index 0000000..c560b3e --- /dev/null +++ b/cd20202/ang-weekend-lab/models/post.js @@ -0,0 +1,35 @@ +/* + * POST MODEL + */ + +var mongoose = require('mongoose'), + Schema = mongoose.Schema; + +var PostSchema = new Schema({ + created_at: { + type: Date, + default: Date.now() + }, + updated_at: { type: Date }, + content: { + type: String, + required: true, + trim: true + } +}); + +// MIDDLEWARE +PostSchema.pre('save', function(next){ + // set a created_at and update updated_at + now = new Date(); + this.updated_at = now; + if ( !this.created_at ) { + this.created_at = now; + } + next(); +}); + +// export post model +var Post = mongoose.model('Post', PostSchema); + +module.exports = Post; diff --git a/cd20202/ang-weekend-lab/package.json b/cd20202/ang-weekend-lab/package.json new file mode 100644 index 0000000..b401b7f --- /dev/null +++ b/cd20202/ang-weekend-lab/package.json @@ -0,0 +1,30 @@ +{ + "name": "seed-mean-html", + "version": "1.0.0", + "description": "MEAN seed project", + "main": "server.js", + "scripts": { + "test": "mocha", + "postinstall": "bower cache clean && bower install", + "start": "node server.js" + }, + "devDependencies": { + "mocha": "*", + "chai": "*" + }, + "engines": { + "node": "0.10.28", + "npm": "2.9.0" + }, + "license": "ISC", + "dependencies": { + "body-parser": "^1.12.3", + "bower": "^1.4.1", + "ejs": "^2.3.3", + "express": "^4.13.3", + "mongoose": "^4.0.2" + }, + "directories": { + "test": "test" + } +} diff --git a/cd20202/ang-weekend-lab/public/app.js b/cd20202/ang-weekend-lab/public/app.js new file mode 100644 index 0000000..7b931ff --- /dev/null +++ b/cd20202/ang-weekend-lab/public/app.js @@ -0,0 +1,22 @@ +/* + * ANGULAR APP.JS + */ + +'use strict'; + +angular.module('myApp', ['ui.router', + 'myApp.controllers']) + + .config(['$stateProvider', '$urlRouterProvider', '$locationProvider', function($stateProvider, $urlRouterProvider, $locationProvider) { + $stateProvider + .state('posts', { + url: "/", + templateUrl: 'templates/posts-index', + controller: 'PostsIndexCtrl' + }); + + $locationProvider.html5Mode({ + enabled: true, + requireBase: false + }); + }]); diff --git a/cd20202/ang-weekend-lab/public/controllers.js b/cd20202/ang-weekend-lab/public/controllers.js new file mode 100644 index 0000000..67f8e3b --- /dev/null +++ b/cd20202/ang-weekend-lab/public/controllers.js @@ -0,0 +1,37 @@ +/* + * CONTROLLERS + */ + +'use strict'; + +angular.module('myApp.controllers', []) + .controller('MainCtrl', ['$rootScope', '$scope', '$location', function ($rootScope, $scope, $location) { + // INITIALIZATION AND NAVBAR LOGIC + }]) + + //POSTS + .controller('PostsIndexCtrl', ['$scope', '$location', '$http', function ($scope, $location, $http) { + + $http.get("http://api.giphy.com/v1/gifs/search?q=funny+cat&api_key=dc6zaTOxFJmzC") + .success(function(response) { + $scope.gifs = response.data; + }) + .error(function(response) { + alert("error: ", response); + }); + + $scope.searchGifs = function() { + $http.get("http://api.giphy.com/v1/gifs/search?q=" + $scope.term + "&api_key=dc6zaTOxFJmzC") + .success(function(response) { + $scope.gifs = response.data; + }) + .error(function(response) { + alert("error: ", response); + }); + }; + $scope.deleteGif = function(gif) { + var index = $scope.gifs.indexOf(gif); + $scope.gifs.splice(index,1); + }; + + }]); diff --git a/cd20202/ang-weekend-lab/public/css/style.css b/cd20202/ang-weekend-lab/public/css/style.css new file mode 100644 index 0000000..91e467b --- /dev/null +++ b/cd20202/ang-weekend-lab/public/css/style.css @@ -0,0 +1 @@ +/*PUT YOUR STYLES HERE*/ diff --git a/cd20202/ang-weekend-lab/public/img/logo.jpg b/cd20202/ang-weekend-lab/public/img/logo.jpg new file mode 100644 index 0000000..24dbd45 Binary files /dev/null and b/cd20202/ang-weekend-lab/public/img/logo.jpg differ diff --git a/cd20202/ang-weekend-lab/routes/index.js b/cd20202/ang-weekend-lab/routes/index.js new file mode 100644 index 0000000..4871b77 --- /dev/null +++ b/cd20202/ang-weekend-lab/routes/index.js @@ -0,0 +1,14 @@ +/* + * INDEX RESOURCES + */ + +exports.index = function(req, res){ + res.render('index'); +}; + +exports.templates = function (req, res) { + var name = req.params.name; + res.render('templates/' + name); +}; + +exports.postRouter = require('./posts.js'); \ No newline at end of file diff --git a/cd20202/ang-weekend-lab/routes/posts.js b/cd20202/ang-weekend-lab/routes/posts.js new file mode 100644 index 0000000..89d1b56 --- /dev/null +++ b/cd20202/ang-weekend-lab/routes/posts.js @@ -0,0 +1,50 @@ +var express = require('express'); +var postRouter = express.Router(); + +var Post = require('../models/post.js'); + +postRouter.route('/') // translates to '/api/posts/' + // send all posts + .get(function(request, response){ + Post.find().sort('-created_at').exec(function(err, posts) { + if (err) { return response.status(404).send(err); } + response.send(posts); + }); + }) + // create new post + .post(function(req,res){ + // var post = new Post({ content: req.body.content }); + // post.save(function (err, post) { + Post.create({ content: req.body.content }, function(err, post){ + if (err) { return res.send(err); } + console.log(post); + res.status(201).send(post); + }); + }); + +postRouter.route('/:post_id') // translates to '/api/posts/:post_id' + // send one post by id + .get(function(req,res){ + Post.findById(req.params.post_id, function(err, post) { + if (err) { return res.status(404).send(err); } + res.send(post); + }); + }) + + // full update of one post by id + .put(function(req,res){ + Post.findOneAndUpdate({ _id: req.params.post_id}, req.query.post, function (err, post) { + if (err) { return res.send(err); } + res.send(post); + }); + }) + + // delete one post by id + .delete(function(req,res){ + Post.findByIdAndRemove(req.params.post_id, function (err, post) { + if (err) { return res.send(err); } + res.status(200).send('Success'); + }); + }); + +module.exports = postRouter; \ No newline at end of file diff --git a/cd20202/ang-weekend-lab/server.js b/cd20202/ang-weekend-lab/server.js new file mode 100644 index 0000000..6e12925 --- /dev/null +++ b/cd20202/ang-weekend-lab/server.js @@ -0,0 +1,69 @@ +/* + * SERVER.JS - setup for server, modules, middleware, database + */ + +// set up base express app +var express = require('express'); +var app = express(); + +// other modules and middleware +var path = require('path'); // built-in module for dealing with file paths +var bodyParser = require('body-parser'); // parse form data into req.body +var mongoose = require('mongoose'); // object document mapper + +// configure bodyparser +app.use(bodyParser.urlencoded({ + extended: true +})); +app.use(bodyParser.json()); + +// connect to database +var dbName = 'seed-mean-html'; +mongoose.connect(process.env.MONGOLAB_URI || 'mongodb://localhost/' + dbName); + +// serve public folder as static assets on the root route +var publicPath = path.join(__dirname, 'public'); +app.use("/", express.static(publicPath)); + +// alias the views folder +// var viewsPath = path.join(__dirname, 'views'); +// app.set('views', viewsPath); + +// set 'html' as the engine, using ejs's renderFile function +var ejs = require('ejs'); +app.engine('html', ejs.renderFile); +app.set('view engine', 'html'); + +/*** ROUTES ***/ +var routes = require('./routes'); + +// INDEX and TEMPLATE ROUTES +app.get('/', routes.index); +// app.get('/', function(request, response){ +// response.render('index'); +// }); + +app.get('/templates/:name', routes.templates); +// app.get('/templates/:name', function(request, response){ +// var name = request.params.name; +// response.render('templates/' + name); +// }); + +// API ROUTES +// post routes +app.use('/api/posts', routes.postRouter); + + +// ALL OTHER ROUTES (ANGULAR HANDLES) +// redirect all other paths to index +app.get('*', routes.index); + + +// SERVER +process.env.NODE_ENV = process.env.NODE_ENV || 'development'; +var port = process.env.PORT || 1337; + +var server = require('http').createServer(app); +server = server.listen(port); +console.log(process.env.NODE_ENV + ' server running at port:' + port); + diff --git a/cd20202/ang-weekend-lab/test/conf.js b/cd20202/ang-weekend-lab/test/conf.js new file mode 100644 index 0000000..f174c8b --- /dev/null +++ b/cd20202/ang-weekend-lab/test/conf.js @@ -0,0 +1,4 @@ +exports.config = { + seleniumAddress: 'http://localhost:4444/wd/hub', + specs: ['gen-spec.js'] +}; \ No newline at end of file diff --git a/cd20202/ang-weekend-lab/test/gen-spec.js b/cd20202/ang-weekend-lab/test/gen-spec.js new file mode 100644 index 0000000..96284b8 --- /dev/null +++ b/cd20202/ang-weekend-lab/test/gen-spec.js @@ -0,0 +1,15 @@ +/* + * TESTS - PROTRACTOR + */ + + // HERE ARE YOUR PROTRACTOR TESTS + // TO RUN THEM RUN THE FOLLOWING IN THE TERMINAL + // $ webdriver-manager start + // $ protractor test/conf.js + +describe('Home Page', function() { + it('should have the correct title', function() { + browser.get('http://localhost:1337/'); + expect(browser.getTitle()).toEqual('MEAN Seed'); + }); +}) \ No newline at end of file diff --git a/cd20202/ang-weekend-lab/views/index.html b/cd20202/ang-weekend-lab/views/index.html new file mode 100644 index 0000000..ca1d8fa --- /dev/null +++ b/cd20202/ang-weekend-lab/views/index.html @@ -0,0 +1,71 @@ + + + + + + + + + MEAN Seed + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cd20202/ang-weekend-lab/views/templates/posts-index.html b/cd20202/ang-weekend-lab/views/templates/posts-index.html new file mode 100644 index 0000000..6b5a1da --- /dev/null +++ b/cd20202/ang-weekend-lab/views/templates/posts-index.html @@ -0,0 +1,38 @@ +

Posts

+
+
+ +
+ +
+ +
+

Search Gifs

+
+
+ +
+ +
+
+
+ + +
+ + + + diff --git a/cd20202/project_two_ideas.md b/cd20202/project_two_ideas.md new file mode 100644 index 0000000..d42bcf5 --- /dev/null +++ b/cd20202/project_two_ideas.md @@ -0,0 +1,11 @@ +#Project Two Ideas + +1. HTML builder - Plug in content and links to build a basic html element + +2. Clock Bock - Site that only does DOS attacks on Jamedr + +3. StoneHearth - Card & turn based online game with ranks based on skill + +4. The Shire - Interactive LOTR middle earth map and adventure + +5. Dr. Powder - Crawls thru all Tahoe, Utah, and Colorado major ski resorts and displays snow reports for each with the ski cam \ No newline at end of file diff --git a/cd20202/w11-d1/micro-blog-parse/README.md b/cd20202/w11-d1/micro-blog-parse/README.md new file mode 100644 index 0000000..174672b --- /dev/null +++ b/cd20202/w11-d1/micro-blog-parse/README.md @@ -0,0 +1,3 @@ +## Gaming Micro Blog built with Parse + +#####created by Chris Dawson \ No newline at end of file diff --git a/cd20202/w11-d1/micro-blog-parse/app.js b/cd20202/w11-d1/micro-blog-parse/app.js new file mode 100644 index 0000000..2f2c8aa --- /dev/null +++ b/cd20202/w11-d1/micro-blog-parse/app.js @@ -0,0 +1,163 @@ +Parse.initialize("rGUykmwSQuq0saepWPoBsdGOUOL1tjqGNJU6OQSQ", + "ISk59kzwQzzL7nyat8DjLBCKTKXmcMZnpJKcwsR0"); + +var PostsObject = Parse.Object.extend("PostsObject"); +var post = new PostsObject(); + +post.save({ + title: "", + imgUrl: "", + post: "", + link: "", + linkname: "", + author: ""}) + .then(function(obj) { + alert("Wicked Awesome!"); + }); + + + +$(document).ready(function(){ + + //created by Chris Dawson + + var postCounter = 1; + var postID = []; + $blogcon = $('#blog'); + + function BlogPost(title, img_url, post_text, link, link_title, author) { + if (title === "") { + title = "Untitled"; + } + if (img_url === "") { + img_url = "http://refugeeks.com/wp-content/uploads/2014/04/203-Non-Auth-Information1-600x480.jpg"; + } + if (post_text === "") { + post_text = "I'm too cool for school because my name is [REDACTED] so I don't fill things out"; + } + if (link_title === "") { + link_title = "Check it out!"; + } + if (link === "") { + link = "https://www.youtube.com/watch?v=0hrqZjw6mUY"; + } + if (author === "") { + author = "Anonymous"; + } + var blogDiv = '

' + + title + '

' + + post_text + '

' + + postCounter +'

'; + + addBlogPost(blogDiv); + postID.push("'#post" + postCounter + "'"); + console.log(postID[postCounter-1]); + + return postCounter++, postID; + } + var addBlogPost = function(rv1) { + $blogcon.children().first().after(rv1); + $('.bpost').addClass('shpost'); + $('.togglesh').hide(); + $('#post-track').text(postCounter); + }; + + var addBlogListeners = function() { + return $('.bpost').on('click', toggleDisplay); + }; + var addNewBlogLisenters = function() { + $('.bpost').off(); + $('.bpost').removeClass('shpost'); + $('.togglesh').hide(); + $('.bpost').children().find('.pImg').addClass('post_img_before'); + $('.bpost').children().find('.pImg').removeClass('post_img_after'); + $('.bpost').addClass('shpost'); + return $('.bpost').on('click', toggleDisplay); + }; + + var toggleDisplay = function() { + $(this).children().find('.pImg').toggleClass('post_img_before'); + $(this).children().find('.pImg').toggleClass('post_img_after'); + $(this).toggleClass('shpost'); + $(this).children().find('.togglesh').toggle(); + }; + + + + var post1 = new BlogPost("[REDACTED]", "", "", "", "", ""); + + var post2 = new BlogPost("Super Smash", + "http://www.ssbwiki.com/images/d/db/User.png", + "blah blah blah, blah blah blah. Super Smash Bros is a really cool game, especially 8 player free-for-all on the Wii-U.", + "https://www.google.com", + "Super Smash Bros", + "cd20202"); + + var post3 = new BlogPost("Halo 5 Is Almost Here!", + "http://zoneg.ru/uploads/posts/2015-03/1425931500_Halo_5_Guardians_icon.png", + "Lest I remind everyone, Oct. 27th, 2015 is the release date for Halo. Remember, I played the Beta and I will destroy you.", + "https://en.wikipedia.org/wiki/Halo_5:_Guardians", + "Halo 5 Guardians WIKI", + "cd20202"); + + var post4 = new BlogPost("Battlefront Beta MEOW OUT!", + "https://cdn0.iconfinder.com/data/icons/black-religious-icons/256/Darth_Vader.png", + "Title says it all bro. Check out the beta meow brotato chip!", + "http://starwars.ea.com/starwars/battlefront/beta", + "Battlefront Beta", + "cd20202"); + + + addBlogListeners(); + + $('#createPost').on('click', function(e) { + e.preventDefault(); + + $title = $('#Title'); + $imgURL = $('#ImageURL'); + $post = $('#Post'); + $linkname = $('#LinkName'); + $link = $('#Link'); + $author = $('#Author'); + + var newpost = new PostsObject(); + newpost.save({ + title: $title.val(), + imgUrl: $imgURL.val(), + post: $post.val(), + link: $link.val(), + linkname: $linkname.val(), + author: $author.val() + }).then(function(obj) { + alert("Wicked Awesome!"); + }); + + addNewBlogLisenters(); + + $title.val(""); + $imgURL.val(""); + $post.val(""); + $link.val(""); + $linkname.val(""); + $author.val(""); + }); + + + $('[data-toggle="tooltip"]').tooltip(); +}); + + + + + + + + + + + + diff --git a/cd20202/w11-d1/micro-blog-parse/index.html b/cd20202/w11-d1/micro-blog-parse/index.html new file mode 100644 index 0000000..274f13c --- /dev/null +++ b/cd20202/w11-d1/micro-blog-parse/index.html @@ -0,0 +1,125 @@ + + + + + + + Game Time Blog + + + + + + + + + + + + + + + +
+
+
+ +
+
+

GAME TIME

+ a game life blog by +
+
+ +
+
+
+
+
+
+

l3uttertoast

+
+
+

cd20202

+
+
+

notSOfunnyM30W

+
+
+
+ + +
+
+
+ +
+
+ +
+
+ +
+
+
+ + + + + + + + + + + + + diff --git a/cd20202/w11-d1/micro-blog-parse/styles.css b/cd20202/w11-d1/micro-blog-parse/styles.css new file mode 100644 index 0000000..58dc661 --- /dev/null +++ b/cd20202/w11-d1/micro-blog-parse/styles.css @@ -0,0 +1,120 @@ +/* + +created by chris dawson + +*/ +.container { + min-width: 760px; + max-width: 800px; +} +.jumbotron { + padding: 0px 15px 0px 15px; + margin-bottom: 0px; + background-color: ; +} +.jumbotron #gametime { + font-size: 85px; + font-family: Times New Roman; + margin-top: 0px; + margin-bottom: 0px; +} +.jumbotron #gametimesmall { + font-size: 15px; + color: black; +} +.header { + height: 125px; + padding: 10px 10px 10px 10px; +} +.gamertag { + color: lightgray; + background-color: darkgray; + text-align: center; +} +.clock { + height: 100%; + width: 100%; +} +.blogActionsBar { + margin: 15px 0px 15px 0px; + height: 40px; +} +button#localsave { + height: 40px; + width: 120px; + color: lightgray; + background-color: darkgray; + border: solid lightgray; +} +button#addPost { + height: 40px; + width: 280px; + color: white; + background-color: darkgray; + border: solid lightgray; +} +button#postNum { + height: 40px; + width: 120px; + color: white; + background-color: darkgray; + border: solid lightgray; +} +.bpost { + border: solid white; + background-color: darkgray; +} +.post_img_before { + height: 25%; + width: 25%; +} +.post_img_after { + height: 100%; + width: 100%; +} +.postAuthor { + padding-top: 100px; +} +#post-track { + font-weight: bold; + color: black; +} +.postTracker { + padding-top: 10px; +} +.shpost { + height: 65px; + opacity: .75; +} +.col-xs-7 h2 { + margin: 15px 0px 15px 0px; +} +.col-xs-2 { + padding: 0px 0px 0px 0px; +} +.col-xs-3 { + padding: 5px 5px 5px 5px; +} +.col-xs-4 h3 { + margin-top: 10px; +} +#gogame h1{ + font-family: Times New Roman;; + font-size: 45px; + color: darkgray; +} +body { + background-image: url(http://pre06.deviantart.net/be1a/th/pre/f/2013/041/5/9/minimalist_star_wars_wallpaper__jedi_emblem_by_diros-d5ui25a.png); + background-size: 100% 125%; + background-repeat: no-repeat; +} + + + + + + + + + +