Skip to content

Instantly share code, notes, and snippets.

View MichaelDCooper's full-sized avatar

Michael Cooper MichaelDCooper

  • Spotify
  • Los Angeles, CA
  • 00:32 (UTC -07:00)
View GitHub Profile
import React from 'react';
import Form from 'react-bootstrap/Form';
import Button from 'react-bootstrap/Button';
const Home = () => (
<Form>
<h4>Monthly Wages</h4>
<Form.Group controlId="wages">
<h5>Salary:</h5>
TypeError: User.findById is not a function
at passport.deserializeUser (/Users/Michael/bloc/wiki/src/config/passport-config.js:32:14)
at pass (/Users/Michael/bloc/wiki/node_modules/passport/lib/authenticator.js:357:9)
at Authenticator.deserializeUser (/Users/Michael/bloc/wiki/node_modules/passport/lib/authenticator.js:362:5)
at SessionStrategy.authenticate (/Users/Michael/bloc/wiki/node_modules/passport/lib/strategies/session.js:60:10)
at attempt (/Users/Michael/bloc/wiki/node_modules/passport/lib/middleware/authenticate.js:361:16)
at authenticate (/Users/Michael/bloc/wiki/node_modules/passport/lib/middleware/authenticate.js:362:7)
at Layer.handle [as handle_request] (/Users/Michael/bloc/wiki/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/Michael/bloc/wiki/node_modules/express/lib/router/index.js:317:13)
at /Users/Michael/bloc/wiki/node_modules/express/lib/router/index.js:284:7
Michaels-MBP:bloccit Michael$ npm test
> bloccit@1.0.0 test /Users/Michael/bloc/bloccit
> export NODE_ENV=test && jasmine
Started
server is listening for requests on port 3000
..........................401
........TypeError: Cannot read property 'title' of null
at Topic.findOne.then (/Users/Michael/bloc/bloccit/spec/integration/topics_spec.js:91:30)
Started
server is listening for requests on port 3000
......................FTypeError: Cannot read property 'title' of null
at Post.findOne.then (/Users/Michael/bloc/bloccit/spec/integration/posts_spec.js:285:29)
at tryCatcher (/Users/Michael/bloc/bloccit/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/Michael/bloc/bloccit/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/Users/Michael/bloc/bloccit/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/Users/Michael/bloc/bloccit/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/Users/Michael/bloc/bloccit/node_modules/bluebird/js/release/promise.js:694:18)
at _drainQueueStep (/Users/Michael/bloc/bloccit/node_modules/bluebird/js/release/async.js:138:12)
Michaels-MacBook-Pro:bloccit Michael$ npm test
> bloccit@1.0.0 test /Users/Michael/bloc/bloccit
> export NODE_ENV=test && jasmine
Started
server is listening for requests on port 3000
.......{ SequelizeValidationError: notNull Violation: Post.userId cannot be null
at Promise.all.then (/Users/Michael/bloc/bloccit/node_modules/sequelize/lib/instance-validator.js:77:15)
at tryCatcher (/Users/Michael/bloc/bloccit/node_modules/bluebird/js/release/util.js:16:23)
1. What is a Node module?
A node module is a set of function that is included in your application.
2.What is the main difference between exports and module.exports?
module.exports is the object returned from require(). It is an object that can
be reassigned into anything.
Exports is a reference to module.exports. It cannot reassign module.exports.
1.How do you find related data held in two separate data tables?
By using join statements to view data from different tables. You can also use
NATURAL to view tables based on shared columns.
2.Explain, in your own words, the difference between an INNER JOIN, LEFT OUTER
JOIN, and RIGHT OUTER JOIN. Give a real-world example for each.
INNER JOIN combines rows from tables based on common rows. LEFT OUTER JOIN uses
the first tables rows as a base, and then combines matching rows from the second table.
1. Write out a generic SELECT statement.
SELECT name
FROM spacecrafts
WHERE name LIKE '%Op%';
2. Create a fun way to remember the order of operations in a SELECT statement, such
as a mnemonic.
SFWAE (SELECT FROM WHERE add extras)
1.List the commands for adding, updating, and deleting data.
For adding we use INSERT INTO (column name or table name) VALUES (values)
For updating we use UPDATE (table name) SET (value) WHERE (condition)
and statements can also be added to conditions.
For deleting we use DELETE FROM (table name) WHERE(condition)
and statements can also be added to conditions
library=# SELECT * FROM books;
id | title | author
------+------------------------------------------+---------------------
1259 | Eloquent Ruby | Russell A. Olson
1593 | JavaScript: The Good Parts | Douglas Crockford
8982 | Designing Object-Oriented Software | Rebecca Wirfs-Brock
7265 | Practical Object-Oriented Design in Ruby | Sandi Metz
(4 rows)
library=#