diff --git a/ian_you/Flask_MySQL/assignment_emailValidation/ERD.mwb b/ian_you/Flask_MySQL/assignment_emailValidation/ERD.mwb
new file mode 100644
index 0000000..bd6fe91
Binary files /dev/null and b/ian_you/Flask_MySQL/assignment_emailValidation/ERD.mwb differ
diff --git a/ian_you/Flask_MySQL/assignment_emailValidation/mysqlconnection.py b/ian_you/Flask_MySQL/assignment_emailValidation/mysqlconnection.py
new file mode 100644
index 0000000..a12daeb
--- /dev/null
+++ b/ian_you/Flask_MySQL/assignment_emailValidation/mysqlconnection.py
@@ -0,0 +1,40 @@
+""" import the necessary modules """
+from flask_sqlalchemy import SQLAlchemy
+from sqlalchemy.sql import text
+# Create a class that will give us an object that we can use to connect to a database
+class MySQLConnection(object):
+ def __init__(self, app, db):
+ config = {
+ 'host': 'localhost',
+ 'database': db, # we got db as an argument
+ 'user': 'root',
+ 'password': 'root',
+ 'port': '3306' # change the port to match the port your SQL server is running on
+ }
+ # this will use the above values to generate the path to connect to your sql database
+ DATABASE_URI = "mysql://{}:{}@127.0.0.1:{}/{}".format(config['user'], config['password'], config['port'], config['database'])
+ app.config['SQLALCHEMY_DATABASE_URI'] = DATABASE_URI
+ app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
+ # establish the connection to database
+ self.db = SQLAlchemy(app)
+ # this is the method we will use to query the database
+ def query_db(self, query, data=None):
+ result = self.db.session.execute(text(query), data)
+ if query[0:6].lower() == 'select':
+ # if the query was a select
+ # convert the result to a list of dictionaries
+ list_result = [dict(r) for r in result]
+ # return the results as a list of dictionaries
+ return list_result
+ elif query[0:6].lower() == 'insert':
+ # if the query was an insert, return the id of the
+ # commit changes
+ self.db.session.commit()
+ # row that was inserted
+ return result.lastrowid
+ else:
+ # if the query was an update or delete, return nothing and commit changes
+ self.db.session.commit()
+# This is the module method to be called by the user in server.py. Make sure to provide the db name!
+def MySQLConnector(app, db):
+ return MySQLConnection(app, db)
diff --git a/ian_you/Flask_MySQL/assignment_emailValidation/server.py b/ian_you/Flask_MySQL/assignment_emailValidation/server.py
new file mode 100644
index 0000000..407f21b
--- /dev/null
+++ b/ian_you/Flask_MySQL/assignment_emailValidation/server.py
@@ -0,0 +1,50 @@
+from flask import Flask, render_template, request, redirect
+# import the Connector function
+from mysqlconnection import MySQLConnector
+app = Flask(__name__)
+# connect and store the connection in "mysql" note that you pass the database name to the function
+mysql = MySQLConnector(app, 'assignment_emailvalidation')
+# an example of running a query
+
+@app.route('/')
+def index():
+ return render_template('index.html')
+
+@app.route('/', methods=['POST'])
+def verify():
+ username = request.form['email'].split('@')[0]
+
+ domainLength = len(request.form['email'].split('@')[1].split('.'))
+
+ i=0
+ domain=""
+
+ for i in range (0, domainLength-1):
+ domain += request.form['email'].split('@')[1].split('.')[i]+"."
+
+ extension = request.form['email'].split('@')[1].split('.')[domainLength-1]
+
+ if username == "" or domain == "" or extension == "":
+ error = "Email is not a valid email address"
+
+ return render_template('index.html', error=error)
+
+ query = "INSERT INTO emails (username, domain, extension, created_at, updated_at) VALUES (:username, :domain, :extension, NOW(), NOW())"
+
+ data = {
+ 'username':username,
+ 'domain': domain,
+ 'extension':extension
+ }
+
+ mysql.query_db(query, data)
+ return redirect ('/success')
+
+@app.route('/success')
+def success():
+ query = "SELECT username, domain, extension, created_at FROM emails;"
+ emails = mysql.query_db(query)
+
+ return render_template('success.html', emails=emails)
+
+app.run(debug=True)
diff --git a/ian_you/Flask_MySQL/assignment_emailValidation/static/css/style.css b/ian_you/Flask_MySQL/assignment_emailValidation/static/css/style.css
new file mode 100644
index 0000000..7c27676
--- /dev/null
+++ b/ian_you/Flask_MySQL/assignment_emailValidation/static/css/style.css
@@ -0,0 +1,8 @@
+h1{
+ color: red;
+}
+
+#Valid{
+ color: black;
+ background-color: green;
+}
diff --git a/ian_you/Flask_MySQL/assignment_emailValidation/templates/index.html b/ian_you/Flask_MySQL/assignment_emailValidation/templates/index.html
new file mode 100644
index 0000000..43d35b9
--- /dev/null
+++ b/ian_you/Flask_MySQL/assignment_emailValidation/templates/index.html
@@ -0,0 +1,18 @@
+
+
+
+
+
diff --git a/ian_you/Flask_MySQL/assignment_friends/ERD.mwb b/ian_you/Flask_MySQL/assignment_friends/ERD.mwb
new file mode 100644
index 0000000..c85eb2b
Binary files /dev/null and b/ian_you/Flask_MySQL/assignment_friends/ERD.mwb differ
diff --git a/ian_you/Flask_MySQL/assignment_friends/ERD.mwb.bak b/ian_you/Flask_MySQL/assignment_friends/ERD.mwb.bak
new file mode 100644
index 0000000..617d991
Binary files /dev/null and b/ian_you/Flask_MySQL/assignment_friends/ERD.mwb.bak differ
diff --git a/ian_you/Flask_MySQL/assignment_friends/mysqlconnection.py b/ian_you/Flask_MySQL/assignment_friends/mysqlconnection.py
new file mode 100644
index 0000000..a12daeb
--- /dev/null
+++ b/ian_you/Flask_MySQL/assignment_friends/mysqlconnection.py
@@ -0,0 +1,40 @@
+""" import the necessary modules """
+from flask_sqlalchemy import SQLAlchemy
+from sqlalchemy.sql import text
+# Create a class that will give us an object that we can use to connect to a database
+class MySQLConnection(object):
+ def __init__(self, app, db):
+ config = {
+ 'host': 'localhost',
+ 'database': db, # we got db as an argument
+ 'user': 'root',
+ 'password': 'root',
+ 'port': '3306' # change the port to match the port your SQL server is running on
+ }
+ # this will use the above values to generate the path to connect to your sql database
+ DATABASE_URI = "mysql://{}:{}@127.0.0.1:{}/{}".format(config['user'], config['password'], config['port'], config['database'])
+ app.config['SQLALCHEMY_DATABASE_URI'] = DATABASE_URI
+ app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
+ # establish the connection to database
+ self.db = SQLAlchemy(app)
+ # this is the method we will use to query the database
+ def query_db(self, query, data=None):
+ result = self.db.session.execute(text(query), data)
+ if query[0:6].lower() == 'select':
+ # if the query was a select
+ # convert the result to a list of dictionaries
+ list_result = [dict(r) for r in result]
+ # return the results as a list of dictionaries
+ return list_result
+ elif query[0:6].lower() == 'insert':
+ # if the query was an insert, return the id of the
+ # commit changes
+ self.db.session.commit()
+ # row that was inserted
+ return result.lastrowid
+ else:
+ # if the query was an update or delete, return nothing and commit changes
+ self.db.session.commit()
+# This is the module method to be called by the user in server.py. Make sure to provide the db name!
+def MySQLConnector(app, db):
+ return MySQLConnection(app, db)
diff --git a/ian_you/Flask_MySQL/assignment_friends/server.py b/ian_you/Flask_MySQL/assignment_friends/server.py
new file mode 100644
index 0000000..9fd678a
--- /dev/null
+++ b/ian_you/Flask_MySQL/assignment_friends/server.py
@@ -0,0 +1,27 @@
+from flask import Flask, render_template, request, redirect
+# import the Connector function
+from mysqlconnection import MySQLConnector
+app = Flask(__name__)
+# connect and store the connection in "mysql" note that you pass the database name to the function
+mysql = MySQLConnector(app, 'assignment_friends')
+# an example of running a query
+
+@app.route('/')
+def index():
+ query = "SELECT * FROM friends;"
+ friends = mysql.query_db(query)
+ return render_template('index.html', friends=friends)
+
+
+@app.route('/add', methods = ['POST'])
+def add():
+ query = "INSERT INTO friends (name, age, created_at, updated_at) VALUES (:name, :age, NOW(), NOW());"
+
+ data = {
+ 'name':request.form['name'],
+ 'age':request.form['age'],
+ }
+ mysql.query_db(query, data)
+ return redirect ('/')
+
+app.run(debug=True)
diff --git a/ian_you/Flask_MySQL/assignment_friends/templates/index.html b/ian_you/Flask_MySQL/assignment_friends/templates/index.html
new file mode 100644
index 0000000..e607935
--- /dev/null
+++ b/ian_you/Flask_MySQL/assignment_friends/templates/index.html
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+ Assignment Friends
+
+
+
+
Add a Friend
+
+
+
+
Friends List
+
+
+
+
Name
+
Age
+
Added Since
+
+
+
+ {% for friend in friends %}
+
+
{{friend['name']}}
+
{{friend['age']}}
+
{{friend['created_at']}}
+
+ {% endfor %}
+
+
+
+
+
diff --git a/ian_you/Python_Flask/Disappearing_Ninja/server.py b/ian_you/Python_Flask/Disappearing_Ninja/server.py
new file mode 100644
index 0000000..1013e68
--- /dev/null
+++ b/ian_you/Python_Flask/Disappearing_Ninja/server.py
@@ -0,0 +1,21 @@
+from flask import Flask, render_template, redirect
+
+app = Flask(__name__)
+
+@app.route('/')
+def index():
+ return render_template('index.html')
+
+@app.route('/ninja')
+def allninja():
+ return render_template('allNinjas.html')
+
+@app.route('/ninja/')
+def colorninja(color):
+ if color == "blue" or color == "red" or color == "orange" or color == "purple":
+ return render_template('ninja.html', color=color)
+ else:
+ color="notapril"
+ return render_template('ninja.html', color=color)
+
+app.run(debug=True)
diff --git a/ian_you/Python_Flask/Disappearing_Ninja/static/img/blue.jpg b/ian_you/Python_Flask/Disappearing_Ninja/static/img/blue.jpg
new file mode 100644
index 0000000..c049cfd
Binary files /dev/null and b/ian_you/Python_Flask/Disappearing_Ninja/static/img/blue.jpg differ
diff --git a/ian_you/Python_Flask/Disappearing_Ninja/static/img/notapril.jpg b/ian_you/Python_Flask/Disappearing_Ninja/static/img/notapril.jpg
new file mode 100644
index 0000000..39b2f0a
Binary files /dev/null and b/ian_you/Python_Flask/Disappearing_Ninja/static/img/notapril.jpg differ
diff --git a/ian_you/Python_Flask/Disappearing_Ninja/static/img/orange.jpg b/ian_you/Python_Flask/Disappearing_Ninja/static/img/orange.jpg
new file mode 100644
index 0000000..4ad75d0
Binary files /dev/null and b/ian_you/Python_Flask/Disappearing_Ninja/static/img/orange.jpg differ
diff --git a/ian_you/Python_Flask/Disappearing_Ninja/static/img/purple.jpg b/ian_you/Python_Flask/Disappearing_Ninja/static/img/purple.jpg
new file mode 100644
index 0000000..8912292
Binary files /dev/null and b/ian_you/Python_Flask/Disappearing_Ninja/static/img/purple.jpg differ
diff --git a/ian_you/Python_Flask/Disappearing_Ninja/static/img/red.jpg b/ian_you/Python_Flask/Disappearing_Ninja/static/img/red.jpg
new file mode 100644
index 0000000..57fb2a3
Binary files /dev/null and b/ian_you/Python_Flask/Disappearing_Ninja/static/img/red.jpg differ
diff --git a/ian_you/Python_Flask/Disappearing_Ninja/static/img/tmnt.png b/ian_you/Python_Flask/Disappearing_Ninja/static/img/tmnt.png
new file mode 100644
index 0000000..941c82e
Binary files /dev/null and b/ian_you/Python_Flask/Disappearing_Ninja/static/img/tmnt.png differ
diff --git a/ian_you/Python_Flask/Disappearing_Ninja/templates/allNinjas.html b/ian_you/Python_Flask/Disappearing_Ninja/templates/allNinjas.html
new file mode 100644
index 0000000..551c178
--- /dev/null
+++ b/ian_you/Python_Flask/Disappearing_Ninja/templates/allNinjas.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ All Ninjas
+
+
+
I am a Python web developer and love going to hackathons in my spare time. I love making things and meeting new people! People might be surprised to learn that I own a horse and used to be a horse trainer.
+
+
+
diff --git a/ian_you/Python_Flask/hello_flask/hello.py b/ian_you/Python_Flask/hello_flask/hello.py
new file mode 100644
index 0000000..e3ad0bd
--- /dev/null
+++ b/ian_you/Python_Flask/hello_flask/hello.py
@@ -0,0 +1,17 @@
+from flask import Flask, render_template # Import Flask to allow us to create our app, and import
+ # render_template to allow us to render index.html.
+app = Flask(__name__) # Global variable __name__ tells Flask whether or not we
+ # are running the file directly or importing it as a module.
+@app.route('/') # The "@" symbol designates a "decorator" which attaches the
+ # following function to the '/' route. This means that
+ # whenever we send a request to localhost:5000/ we will run
+ # the following "hello_world" function.
+def hello_world():
+ return render_template('index.html') # Render the template and return it!
+
+
+@app.route('/success')
+def success():
+ return render_template('success.html')
+
+app.run(debug=True) # Run the app in debug mode.
diff --git a/ian_you/Python_Flask/hello_flask/templates/index.html b/ian_you/Python_Flask/hello_flask/templates/index.html
new file mode 100644
index 0000000..efbd83f
--- /dev/null
+++ b/ian_you/Python_Flask/hello_flask/templates/index.html
@@ -0,0 +1,5 @@
+
+
+