- Seattle, WA
- 719-440-6534
- [email protected]
- Github
- Portfolio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form ng-submit="CONTROLLER.submitTopic(); topicForm.$setPristine();" name="topicForm" novalidate> | |
<div class="input-field"> | |
<input type="text" name="name" ng-class="{'valid': topicForm.name.$valid, 'invalid': topicForm.name.$invalid && topicForm.name.$dirty}" ng-model="CONTROLLER.topicForm.name" ng-minlength=3 ng-maxlength=15 required> | |
<label for="name" ng-class="{'green-text text-lighten-2': topicForm.name.$valid, 'red-text text-lighten-2': topicForm.name.$invalid && topicForm.name.$dirty}">Topic Name</label> | |
<span ng-show="topicForm.name.$error.minlength && topicForm.name.$dirty">Topic must be at least 3 characters</span> | |
<span ng-show="topicForm.name.$error.maxlength && topicForm.name.$dirty">Topic must be less than 15 characters</span> | |
<input type="submit" class="btn orange darken-1 right" ng-class="{'disabled': topicForm.$invalid, 'waves-effect waves-light': topicForm.$valid}" value="Add Topic" ng-disabled="topicForm.$invalid"> |
After changing into your project directory for Galvanize Bookshelf, ensure the master branch is clean and make a new branch called validations
cd PATH_TO/galvanize_bookshelf
git checkout -b validations
In a new directory called validations, create validation files for each routes file
For today’s warmup, your goal is to refactor your error handling middleware to render an error template.
- Create a new template in the views directory called
error.ejs
- Change your
404
and500
error handlers to rendererror.ejs
with information from the error object. (err.message, err.status, err.stack, etc.) - Use Materialize to style the page however you’d like, think of GitHub’s 404 page for inspiration.
Your refactored error handlers could look like this:
app.use(function(_req, res, next) {
var err = new Error('Not Found');
Given the pokemon_list data set, in a server.js
file, implement an Express server that renders the following index.ejs
template when visiting localhost:8000/pokemon
.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>All Pokemon</title>
</head>
<body>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Input: Any string of words with/without punctuation. | |
// Output: A scrambled form of the same sentence but with the word's first and last | |
// letter's positions intact. | |
var myString = "According to a research team at Cambridge University, it doesn't matter in what order the letters in a word are, the only important thing is that the first and last letter be in the right place. The rest can be a total mess and you can still read it without a problem. This is because the human mind does not read every letter by itself, but the word as a whole. Such a condition is appropriately called Typoglycemia."; | |
// scramble(myString) => "Acrdinocg to a recreash taem at Cirbgmade Uvinsertiy, it deno'st maettr in waht oderr the lterets in a wrod are, the olny intapromt thing is taht the fsrit and last lteetr be in the rgiht palce. The rset can be a taotl mses and you can stlil read it wohtiut a pebrolm. This is beuscae the hmaun mind does not raed erevy ltteer by iteslf, but the wrod as a wolhe. Such a ctoiodnin is atrrp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Materialize It!</title> | |
// Google Material Icons | |
<link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> | |
// Google Material CSS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>CSS Basics</title> | |
<link rel="stylesheet" href="styles.css" /> | |
<!-- <link rel="stylesheet" href="normalize.css"> --> | |
<!-- <link rel="stylesheet" href="meyer_reset.css"> --> | |
</head> | |
<body> |