-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
63a739e
commit 4953e3b
Showing
22 changed files
with
1,413 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"commonjs": true, | ||
"node": true | ||
}, | ||
"extends": "prettier", | ||
"plugins": [ | ||
"prettier" | ||
], | ||
"rules": { | ||
"no-duplicate-case":"error", | ||
"no-empty":"error", | ||
"no-extra-semi":"error", | ||
"no-func-assign": "error", | ||
"no-irregular-whitespace":"error", | ||
"no-unreachable": "error", | ||
"curly": "error", | ||
"dot-notation": "error", | ||
"eqeqeq": "error", | ||
"no-empty-function": "error", | ||
"no-multi-spaces": "error", | ||
"no-unused-vars": "error", | ||
"camelcase": "error", | ||
"indent": [ | ||
"error", | ||
2 | ||
], | ||
"quotes": [ | ||
"error", | ||
"double" | ||
], | ||
"semi": [ | ||
"error", | ||
"always" | ||
], | ||
"prettier/prettier": "error" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.DS_Store | ||
node_modules | ||
npm-debug.log | ||
.env |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
language: node_js | ||
node_js: "10" | ||
branches: | ||
only: | ||
- master | ||
cache: | ||
directories: | ||
- node_modules | ||
before_install: | ||
- mysql -e 'CREATE DATABASE testdb;' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"development": { | ||
"username": "root", | ||
"password": null, | ||
"database": "exampledb", | ||
"host": "localhost", | ||
"dialect": "mysql" | ||
}, | ||
"test": { | ||
"username": "root", | ||
"password": null, | ||
"database": "testdb", | ||
"host": "localhost", | ||
"dialect": "mysql", | ||
"logging": false | ||
}, | ||
"production": { | ||
"use_env_variable": "JAWSDB_URL", | ||
"dialect": "mysql" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
var num_1 = parseInt(prompt("Give me a number!")); | ||
var num_2 = parseInt(prompt("Give me another number!")); | ||
var result; | ||
|
||
var operation = prompt("What would you like to do? (add, subtract, multiply, divide)").toUpperCase(); | ||
|
||
if (operation == "ADD") { | ||
var result = num_1 + num_2; | ||
alert("The sum of " + num_1 + " and " + num_2 + " is " + result); | ||
} else if ( operation === "SUBTRACT") | ||
{ | ||
result = num_1 - num_2; | ||
alert("The difference between " + num_1 + " and " + num_2 + " is " + result); | ||
} | ||
else if (operation === "MULTIPLY") { | ||
result = num_1 * num_2; | ||
alert("The product of " + num_1 + " and " + num_2 + " is " + result); | ||
} else if (operation === "DIVIDE") { | ||
result = num_1 / num_2; | ||
alert("The quotient of " + num_1 + " and " + num_2 + " is " + result); | ||
} else { | ||
alert("Not a valid option!"); | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
<title>Calculator</title> | ||
</head> | ||
<body> | ||
<script src="example.js"></script> | ||
</body> | ||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = function(sequelize, DataTypes) { | ||
var Example = sequelize.define("Example", { | ||
text: DataTypes.STRING, | ||
description: DataTypes.TEXT | ||
}); | ||
return Example; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
"use strict"; | ||
|
||
var fs = require("fs"); | ||
var path = require("path"); | ||
var Sequelize = require("sequelize"); | ||
var basename = path.basename(module.filename); | ||
var env = process.env.NODE_ENV || "development"; | ||
var config = require(__dirname + "/../config/config.json")[env]; | ||
var db = {}; | ||
|
||
if (config.use_env_variable) { | ||
var sequelize = new Sequelize(process.env[config.use_env_variable]); | ||
} else { | ||
var sequelize = new Sequelize( | ||
config.database, | ||
config.username, | ||
config.password, | ||
config | ||
); | ||
} | ||
|
||
fs.readdirSync(__dirname) | ||
.filter(function(file) { | ||
return ( | ||
file.indexOf(".") !== 0 && file !== basename && file.slice(-3) === ".js" | ||
); | ||
}) | ||
.forEach(function(file) { | ||
var model = sequelize.import(path.join(__dirname, file)); | ||
db[model.name] = model; | ||
}); | ||
|
||
Object.keys(db).forEach(function(modelName) { | ||
if (db[modelName].associate) { | ||
db[modelName].associate(db); | ||
} | ||
}); | ||
|
||
db.sequelize = sequelize; | ||
db.Sequelize = Sequelize; | ||
|
||
module.exports = db; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
DROP DATABASE IF EXISTS exampledb; | ||
CREATE DATABASE exampledb; | ||
|
||
DROP DATABASE IF EXISTS testdb; | ||
CREATE DATABASE testdb; |
Oops, something went wrong.