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 @@ + + + + + + + Assignment Email Validation + + + + +

{{error}}

+
+

Email Address:

+

+
+ + diff --git a/ian_you/Flask_MySQL/assignment_emailValidation/templates/success.html b/ian_you/Flask_MySQL/assignment_emailValidation/templates/success.html new file mode 100644 index 0000000..48277ac --- /dev/null +++ b/ian_you/Flask_MySQL/assignment_emailValidation/templates/success.html @@ -0,0 +1,26 @@ + + + + + + + Assignment Email Validation + + + + +
+ The email address you entered "" is a VALID email address! Thank you! + +
+

Email Address Entered

+ + {% for email in emails %} + + + + + {% endfor%} +
{{email['username']+'@'+email['domain']+email['extension']}}{{email['created_at']}}
+ + 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

+ + + + + + + + + + {% for friend in friends %} + + + + + + {% endfor %} + +
NameAgeAdded Since
{{friend['name']}}{{friend['age']}}{{friend['created_at']}}
+
+ + 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 + + +

All Ninjas

+ All Ninjas + + diff --git a/ian_you/Python_Flask/Disappearing_Ninja/templates/index.html b/ian_you/Python_Flask/Disappearing_Ninja/templates/index.html new file mode 100644 index 0000000..5488af6 --- /dev/null +++ b/ian_you/Python_Flask/Disappearing_Ninja/templates/index.html @@ -0,0 +1,12 @@ + + + + + + + No Ninja + + +

No Ninjas Here~

+ + diff --git a/ian_you/Python_Flask/Disappearing_Ninja/templates/ninja.html b/ian_you/Python_Flask/Disappearing_Ninja/templates/ninja.html new file mode 100644 index 0000000..36dcf68 --- /dev/null +++ b/ian_you/Python_Flask/Disappearing_Ninja/templates/ninja.html @@ -0,0 +1,13 @@ + + + + + + + Ninja + + +

Ninja

+ Blue Ninja + + diff --git a/ian_you/Python_Flask/FunwithFunctions/assignment.py b/ian_you/Python_Flask/FunwithFunctions/assignment.py new file mode 100644 index 0000000..742f80a --- /dev/null +++ b/ian_you/Python_Flask/FunwithFunctions/assignment.py @@ -0,0 +1,36 @@ +# Odd /Even + +def oddEven(): + for i in range (1,2001): + if i%2==0: + print "Number is "+str(i)+". This is an even number." + else: + print "Number is "+str(i)+". This is an odd number." + +oddEven() + +# Multiply +def multiply(a, c): + new=[] + for i in range (0, len(a)): + new.append(a[i]*c) + return new + +a = [2,4,10,16] +b = multiply(a, 5) +print b + + + +# Hacker Challenge (!!!Not Finished!!!) +def hackerChanllenge(arr): + new_array=[] + for j in range (len(arr)): + small_list = [] + for k in range (arr[j]): + small_list.append(1) + new_array.append(small_list) + return new_array + +x= hackerChanllenge(multiply([2,4,5],3)) +print x diff --git a/ian_you/Python_Flask/Hello World/helloworld.py b/ian_you/Python_Flask/Hello World/helloworld.py new file mode 100644 index 0000000..4b29ecb --- /dev/null +++ b/ian_you/Python_Flask/Hello World/helloworld.py @@ -0,0 +1,10 @@ +from flask import Flask, render_template + +app = Flask(__name__) + +@app.route('/') + +def hello_world(): + return render_template('index.html') + +app.run(debug=True) diff --git a/ian_you/Python_Flask/Hello World/templates/index.html b/ian_you/Python_Flask/Hello World/templates/index.html new file mode 100644 index 0000000..ecdcef2 --- /dev/null +++ b/ian_you/Python_Flask/Hello World/templates/index.html @@ -0,0 +1,13 @@ + + + + + + + Hello World + + +

Hello World!

+

My name is Ian

+ + diff --git a/ian_you/Python_Flask/Landing Page/server.py b/ian_you/Python_Flask/Landing Page/server.py new file mode 100644 index 0000000..4e911a8 --- /dev/null +++ b/ian_you/Python_Flask/Landing Page/server.py @@ -0,0 +1,13 @@ +from flask import Flask, render_template + +app= Flask(__name__) +@app.route('/') +def index(): + return render_template("index.html", word="Home Page") +@app.route('/ninjas') +def ninjas(): + return render_template("ninjas.html", word="Ninjas") +@app.route('/dojos/new') +def dojo(): + return render_template("dojos.html", word="Ninjas") +app.run(debug=True) diff --git a/ian_you/Python_Flask/Landing Page/static/css/style.css b/ian_you/Python_Flask/Landing Page/static/css/style.css new file mode 100644 index 0000000..c98dc89 --- /dev/null +++ b/ian_you/Python_Flask/Landing Page/static/css/style.css @@ -0,0 +1,12 @@ +h1 +{ + color: blue; +} + +p{ + background: green; +} + +img { + height: 200px; +} diff --git a/ian_you/Python_Flask/Landing Page/static/img/Ninja.png b/ian_you/Python_Flask/Landing Page/static/img/Ninja.png new file mode 100644 index 0000000..87f655b Binary files /dev/null and b/ian_you/Python_Flask/Landing Page/static/img/Ninja.png differ diff --git a/ian_you/Python_Flask/Landing Page/static/js/script.js b/ian_you/Python_Flask/Landing Page/static/js/script.js new file mode 100644 index 0000000..d09c0da --- /dev/null +++ b/ian_you/Python_Flask/Landing Page/static/js/script.js @@ -0,0 +1,5 @@ +$(document).ready(function(){ + $('button').click(function(){ + alert("Hello World"); + }); +}); diff --git a/ian_you/Python_Flask/Landing Page/templates/dojos.html b/ian_you/Python_Flask/Landing Page/templates/dojos.html new file mode 100644 index 0000000..eaf1461 --- /dev/null +++ b/ian_you/Python_Flask/Landing Page/templates/dojos.html @@ -0,0 +1,24 @@ + + + + + + + + + + + + Dojos + + +
+

First Name:

+

Last Name:

+

Email Address:

+

Phone Number:

+ +

+
+ + diff --git a/ian_you/Python_Flask/Landing Page/templates/index.html b/ian_you/Python_Flask/Landing Page/templates/index.html new file mode 100644 index 0000000..52e84ff --- /dev/null +++ b/ian_you/Python_Flask/Landing Page/templates/index.html @@ -0,0 +1,19 @@ + + + + + + + + + + + Document + + +

This is {{word}}

+

+ + diff --git a/ian_you/Python_Flask/Landing Page/templates/ninjas.html b/ian_you/Python_Flask/Landing Page/templates/ninjas.html new file mode 100644 index 0000000..d86a545 --- /dev/null +++ b/ian_you/Python_Flask/Landing Page/templates/ninjas.html @@ -0,0 +1,16 @@ + + + + + + + + + Ninjas + + +

This ia page for {{word}}

+

Sadly, there is no information on {{word}}

+ Ninja Penguin + + diff --git a/ian_you/Python_Flask/Making_Dictionaries/assignment.py b/ian_you/Python_Flask/Making_Dictionaries/assignment.py new file mode 100644 index 0000000..3152074 --- /dev/null +++ b/ian_you/Python_Flask/Making_Dictionaries/assignment.py @@ -0,0 +1,35 @@ +name = ["Anna", "Eli", "Pariece", "Brendan", "Amy", "Shane", "Oscar"] +favorite_animal = ["horse", "cat", "spider", "giraffe", "ticks", "dolphins", "llamas"] + +def make_dict(arr1, arr2): + new_dict = {} + for i in range (0,len(arr1)): + new_dict[str(arr1[i])]= str(arr2[i]) + print new_dict + return new_dict + +make_dict(name, favorite_animal) + + +#Hacker Challenge + +names = ["Anna", "Eli", "Pariece", "Brendan", "Amy", "Shane", "Oscar", "James", "Paolo", "Ian", "Authman", "Matt"] +animals = ["horse", "cat", "spider", "giraffe", "ticks", "dolphins", "llamas"] + +def unevenDict(arr3, arr4): + new_dict1 = {} + if len(arr3) > len(arr4): + keyList = arr3 + valList = arr4 + elif len(arr3) < len(arr4): + keyList = arr4 + valList = arr3 + for i in range (0, len(valList)): + new_dict1[str(keyList[i])]=str(valList[i]) + for j in range (len(valList), len(keyList)): + new_dict1[str(keyList[j])]="" + + print new_dict1 + return new_dict1 + +unevenDict(names, animals) diff --git a/ian_you/Python_Flask/Portfolio/portfolio.py b/ian_you/Python_Flask/Portfolio/portfolio.py new file mode 100644 index 0000000..65f2711 --- /dev/null +++ b/ian_you/Python_Flask/Portfolio/portfolio.py @@ -0,0 +1,20 @@ +from flask import Flask, render_template + +app = Flask(__name__) + +@app.route('/') + +def index(): + return render_template('index.html') + +@app.route('/projects') + +def projects(): + return render_template('projects.html') + +@app.route('/about') + +def about(): + return render_template('about.html') + +app.run(debug=True) diff --git a/ian_you/Python_Flask/Portfolio/templates/about.html b/ian_you/Python_Flask/Portfolio/templates/about.html new file mode 100644 index 0000000..a927a87 --- /dev/null +++ b/ian_you/Python_Flask/Portfolio/templates/about.html @@ -0,0 +1,12 @@ + + + + + + + About + + +

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/Portfolio/templates/index.html b/ian_you/Python_Flask/Portfolio/templates/index.html new file mode 100644 index 0000000..86bcfed --- /dev/null +++ b/ian_you/Python_Flask/Portfolio/templates/index.html @@ -0,0 +1,12 @@ + + + + + + + Portfolio + + +

Welcome to my portfolio! My name is Ian

+ + diff --git a/ian_you/Python_Flask/Portfolio/templates/projects.html b/ian_you/Python_Flask/Portfolio/templates/projects.html new file mode 100644 index 0000000..03dad0f --- /dev/null +++ b/ian_you/Python_Flask/Portfolio/templates/projects.html @@ -0,0 +1,19 @@ + + + + + + + Projects + + +

My Projects:

+ + + diff --git a/ian_you/Python_Flask/dojo_survey/server.py b/ian_you/Python_Flask/dojo_survey/server.py new file mode 100644 index 0000000..a3ef042 --- /dev/null +++ b/ian_you/Python_Flask/dojo_survey/server.py @@ -0,0 +1,17 @@ +from flask import Flask, render_template, request, redirect +app = Flask(__name__) + +@app.route('/') +def index(): + return render_template('index.html') + +@app.route('/result', methods=['POST']) +def result(): + name=request.form['name'] + location=request.form['location'] + favLang=request.form['favLang'] + comment=request.form['comment'] + + return render_template('result.html', name=name, location=location, favLang=favLang, comment=comment) + +app.run(debug=True) diff --git a/ian_you/Python_Flask/dojo_survey/static/css/style.css b/ian_you/Python_Flask/dojo_survey/static/css/style.css new file mode 100644 index 0000000..2bdf075 --- /dev/null +++ b/ian_you/Python_Flask/dojo_survey/static/css/style.css @@ -0,0 +1,25 @@ +*{ + align-items: center; + text-align: center; +} +div.border{ + border: 1px solid black; + display: inline-block; + width: 450px; + text-align: center; + padding-bottom: 20px; +} + +p{ + padding:10px 50px 10px 50px; + text-align: left; +} + +input { + float: right; + text-align: left; +} + +textarea{ + text-align: left; +} diff --git a/ian_you/Python_Flask/dojo_survey/static/css/style_result.css b/ian_you/Python_Flask/dojo_survey/static/css/style_result.css new file mode 100644 index 0000000..4ed4a74 --- /dev/null +++ b/ian_you/Python_Flask/dojo_survey/static/css/style_result.css @@ -0,0 +1,35 @@ +*{ + align-items: center; + text-align: center; +} + +div.border{ + border: 1px solid black; + display: inline-block; + width: 450px; + text-align: center; + padding:20px; + vertical-align: top; +} + +h1{ + text-decoration: underline; + text-align: left; +} +.template{ + display: inline-block; + width: 200px; +} + +.result{ + display: inline-block; + width: 200px; +} +p{ + padding:10px; + text-align: left; +} + +a button{ + float: right; +} diff --git a/ian_you/Python_Flask/dojo_survey/templates/index.html b/ian_you/Python_Flask/dojo_survey/templates/index.html new file mode 100644 index 0000000..b9a6aab --- /dev/null +++ b/ian_you/Python_Flask/dojo_survey/templates/index.html @@ -0,0 +1,41 @@ + + + + + + + Dojo Survey + + + +
+
+

Your Name: + +

+

Dojo Location: + + + +

+

Favorite Language: + + + +

+

Comment (Optional)

+

+

+
+ + +
+ + diff --git a/ian_you/Python_Flask/dojo_survey/templates/result.html b/ian_you/Python_Flask/dojo_survey/templates/result.html new file mode 100644 index 0000000..e8e622c --- /dev/null +++ b/ian_you/Python_Flask/dojo_survey/templates/result.html @@ -0,0 +1,31 @@ + + + + + + + Result Page + + + +
+

Submitted Info

+
+

Name:

+

Dojo Location:

+

Favorite Language:

+

Comment:

+
+
+

{{name}}

+

{{location}}

+

{{favLang}}

+

{{comment}}

+ +
+ + +
+ + + 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 @@ + + +

Hello Flask!

+ + diff --git a/ian_you/Python_Flask/hello_flask/templates/success.html b/ian_you/Python_Flask/hello_flask/templates/success.html new file mode 100644 index 0000000..cb2a1fe --- /dev/null +++ b/ian_you/Python_Flask/hello_flask/templates/success.html @@ -0,0 +1,5 @@ + + +

Yay you successfully created another GET route that serves a page!

+ + diff --git a/ian_you/Python_Flask/whatsmyname/server.py b/ian_you/Python_Flask/whatsmyname/server.py new file mode 100644 index 0000000..3ce96d7 --- /dev/null +++ b/ian_you/Python_Flask/whatsmyname/server.py @@ -0,0 +1,15 @@ +from flask import Flask, render_template, redirect, request + +app= Flask(__name__) + +@app.route('/') +def index(): + return render_template("index.html") + +@app.route('/process', methods=['POST']) +def process(): + name = request.form['name'] + print name + return redirect('/') + +app.run(debug=True) diff --git a/ian_you/Python_Flask/whatsmyname/templates/index.html b/ian_you/Python_Flask/whatsmyname/templates/index.html new file mode 100644 index 0000000..69d02f7 --- /dev/null +++ b/ian_you/Python_Flask/whatsmyname/templates/index.html @@ -0,0 +1,15 @@ + + + + + + + Document + + +
+ Your Name: +

+
+ + diff --git a/ian_you/Python_OOP/Bike/assignment.py b/ian_you/Python_OOP/Bike/assignment.py new file mode 100644 index 0000000..44a6c3b --- /dev/null +++ b/ian_you/Python_OOP/Bike/assignment.py @@ -0,0 +1,43 @@ +class Bike(object): + def __init__(self, price, max_speed): + self.price = price + self.max_speed= max_speed + self.miles = 0 + # self.miles=miles + + def displayInfo(self): + print "Price: {} Max Speed: {} Miles {}".format(self.price, self.max_speed, self.miles) + + def ride(self): + self.miles += 10 + print "Riding..." ,self.miles + + def reverse(self): + self.miles -= 5 + if self.miles < 0 : + self.miles = 0 + print "Reversing..." , self.miles + +bike1 = Bike(200, "25mph") +bike2 = Bike(150, "20mph") +bike3 = Bike(300, "30mph") + +bike1.ride() +bike1.ride() +bike1.ride() +bike1.reverse() +bike1.displayInfo() + +bike2.ride() +bike2.ride() +bike2.reverse() +bike2.reverse() +bike2.displayInfo() + +bike3.ride() +bike3.ride() +bike3.ride() +bike3.displayInfo() + +# bike2.displayInfo() +# bike3.displayInfo() diff --git a/ian_you/mySQL/Assignment_Blogs/assignment_blogs.mwb b/ian_you/mySQL/Assignment_Blogs/assignment_blogs.mwb new file mode 100644 index 0000000..7f5a9e1 Binary files /dev/null and b/ian_you/mySQL/Assignment_Blogs/assignment_blogs.mwb differ diff --git a/ian_you/mySQL/Assignment_Blogs/assignment_blogs.mwb.bak b/ian_you/mySQL/Assignment_Blogs/assignment_blogs.mwb.bak new file mode 100644 index 0000000..71413a3 Binary files /dev/null and b/ian_you/mySQL/Assignment_Blogs/assignment_blogs.mwb.bak differ diff --git a/ian_you/mySQL/Assignment_Books/assignmentbooks.mwb b/ian_you/mySQL/Assignment_Books/assignmentbooks.mwb new file mode 100644 index 0000000..53484b1 Binary files /dev/null and b/ian_you/mySQL/Assignment_Books/assignmentbooks.mwb differ diff --git a/ian_you/mySQL/Assignment_Books/assignmentbooks.mwb.bak b/ian_you/mySQL/Assignment_Books/assignmentbooks.mwb.bak new file mode 100644 index 0000000..5043695 Binary files /dev/null and b/ian_you/mySQL/Assignment_Books/assignmentbooks.mwb.bak differ diff --git a/ian_you/mySQL/Assignment_User_Dashboard/assignment_user_dashboard.mwb b/ian_you/mySQL/Assignment_User_Dashboard/assignment_user_dashboard.mwb new file mode 100644 index 0000000..44fa472 Binary files /dev/null and b/ian_you/mySQL/Assignment_User_Dashboard/assignment_user_dashboard.mwb differ diff --git a/ian_you/mySQL/Assignment_User_Dashboard/assignment_user_dashboard.mwb.bak b/ian_you/mySQL/Assignment_User_Dashboard/assignment_user_dashboard.mwb.bak new file mode 100644 index 0000000..fd2cfc5 Binary files /dev/null and b/ian_you/mySQL/Assignment_User_Dashboard/assignment_user_dashboard.mwb.bak differ diff --git a/ian_you/mySQL/Assignment_WorkbenchSetup/mySQL_command.txt b/ian_you/mySQL/Assignment_WorkbenchSetup/mySQL_command.txt new file mode 100644 index 0000000..45ab43d --- /dev/null +++ b/ian_you/mySQL/Assignment_WorkbenchSetup/mySQL_command.txt @@ -0,0 +1 @@ +USE twitter \ No newline at end of file diff --git a/ian_you/mySQL/Assignment_WorkbenchSetup/twitter.sql b/ian_you/mySQL/Assignment_WorkbenchSetup/twitter.sql new file mode 100644 index 0000000..925e1cd --- /dev/null +++ b/ian_you/mySQL/Assignment_WorkbenchSetup/twitter.sql @@ -0,0 +1,147 @@ +CREATE DATABASE IF NOT EXISTS `twitter` /*!40100 DEFAULT CHARACTER SET utf8 */; +USE `twitter`; +-- MySQL dump 10.13 Distrib 5.6.19, for osx10.7 (i386) +-- +-- Host: 127.0.0.1 Database: twitter +-- ------------------------------------------------------ +-- Server version 5.5.38 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `faves` +-- + +DROP TABLE IF EXISTS `faves`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `faves` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `tweet_id` int(11) NOT NULL, + `created_at` datetime DEFAULT NULL, + `updated_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `fk_faves_users1_idx` (`user_id`), + KEY `fk_faves_tweets1_idx` (`tweet_id`), + CONSTRAINT `fk_faves_tweets1` FOREIGN KEY (`tweet_id`) REFERENCES `tweets` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `fk_faves_users1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `faves` +-- + +LOCK TABLES `faves` WRITE; +/*!40000 ALTER TABLE `faves` DISABLE KEYS */; +INSERT INTO `faves` VALUES (1,2,1,'2010-02-01 00:00:01','2010-02-01 00:00:01'),(2,2,2,'2010-02-01 00:00:01','2010-02-01 00:00:01'),(3,3,4,'2010-02-01 00:00:01','2010-02-01 00:00:01'),(4,4,3,'2010-02-01 00:00:01','2010-02-01 00:00:01'),(5,1,9,'2010-02-01 00:00:01','2010-02-01 00:00:01'),(6,1,10,'2010-02-01 00:00:01','2010-02-01 00:00:01'),(7,1,11,'2010-02-01 00:00:01','2010-02-01 00:00:01'); +/*!40000 ALTER TABLE `faves` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `follows` +-- + +DROP TABLE IF EXISTS `follows`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `follows` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `followed_id` int(11) NOT NULL, + `follower_id` int(11) DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + `updated_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `fk_follows_users_idx` (`followed_id`), + CONSTRAINT `fk_follows_users` FOREIGN KEY (`followed_id`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `follows` +-- + +LOCK TABLES `follows` WRITE; +/*!40000 ALTER TABLE `follows` DISABLE KEYS */; +INSERT INTO `follows` VALUES (1,1,2,'2010-02-01 00:00:01','2010-02-01 00:00:01'),(2,1,3,'2010-02-01 00:00:01','2010-02-01 00:00:01'),(3,1,4,'2010-02-01 00:00:01','2010-02-01 00:00:01'),(4,1,5,'2010-02-01 00:00:01','2010-02-01 00:00:01'),(5,3,4,'2010-02-01 00:00:01','2010-02-01 00:00:01'),(6,3,5,'2010-02-01 00:00:01','2010-02-01 00:00:01'),(7,2,4,'2010-02-01 00:00:01','2010-02-01 00:00:01'); +/*!40000 ALTER TABLE `follows` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `tweets` +-- + +DROP TABLE IF EXISTS `tweets`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tweets` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `tweet` varchar(140) DEFAULT NULL, + `user_id` int(11) NOT NULL, + `created_at` datetime DEFAULT NULL, + `updated_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `fk_tweets_users1_idx` (`user_id`), + CONSTRAINT `fk_tweets_users1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `tweets` +-- + +LOCK TABLES `tweets` WRITE; +/*!40000 ALTER TABLE `tweets` DISABLE KEYS */; +INSERT INTO `tweets` VALUES (1,'There is power in understanding the journey of others to help create your own',1,'2002-02-01 00:00:01','2002-02-01 00:00:01'),(2,'Congrats Coach K! Amazing accomplishment #1KforCoachK #Duke',1,'2005-02-01 00:00:01','2005-02-01 00:00:01'),(3,'This is what happens when I pass too much! #ShoulderShock thank u all for ur thoughts and prayers #team @DrinkBODYARMOR @Lakers #oneluv',1,'2004-02-01 00:00:01','2004-02-01 00:00:01'),(4,'Feeling a mix of emotions I haven\'t felt in 18yrs of being a pro #journey #19th',1,'2012-02-01 00:00:01','2012-02-01 00:00:01'),(5,'Thank you everyone for the birthday wishes. I appreciate you all.',2,'2011-02-01 00:00:01','2011-02-01 00:00:01'),(6,'I\'d like to wish everyone a very Merry Christmas. 1 love to all \"Be Safe\"',2,'2009-02-01 00:00:01','2009-02-01 00:00:01'),(7,'Thanks to all who helped with the Christmas food baskets today. Your time is greatly appreciated. Love & Respect!! ',2,'2008-02-01 00:00:01','2008-02-01 00:00:01'),(8,'I took on the ALS Challenge from Monta Ellis. I challenge @coolkesh42 Jameer Nelson, Dionne Calhoun ... http://tmi.me/1eFAxT ',2,'2003-02-01 00:00:01','2003-02-01 00:00:01'),(9,'Well done lil bro, you deserve it!! @KingJames',3,'2006-02-01 00:00:01','2006-02-01 00:00:01'),(10,'For my basketball clinic with @manilacone 11/4/14, we still have a few slots left for the main game. See you all 11/5/14 Philippines',3,'2001-02-01 00:00:01','2001-02-01 00:00:01'),(11,'Always have a great time with my big little brother. ',4,'2011-02-01 00:00:01','2011-02-01 00:00:01'),(12,'Happy Labor Day..',4,'2014-02-01 00:00:01','2014-02-01 00:00:01'); +/*!40000 ALTER TABLE `tweets` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `users` +-- + +DROP TABLE IF EXISTS `users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `users` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `first_name` varchar(255) DEFAULT NULL, + `last_name` varchar(255) DEFAULT NULL, + `handle` varchar(255) DEFAULT NULL, + `birthday` date DEFAULT NULL, + `created_at` datetime DEFAULT NULL, + `updated_at` datetime DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `users` +-- + +LOCK TABLES `users` WRITE; +/*!40000 ALTER TABLE `users` DISABLE KEYS */; +INSERT INTO `users` VALUES (1,'Kobe','Bryant','kobebryant','1978-08-23','2010-02-01 00:00:01','2011-07-01 00:00:01'),(2,'Vince','Carter','mrvincecarter15','1977-01-26','2007-08-11 00:00:01','2010-01-01 00:00:01'),(3,'Allen','Iverson','alleniverson','1975-06-07','2005-09-01 00:00:01','2011-04-21 00:00:01'),(4,'Tracy','McGrady','Real_T_Mac','1979-05-24','2002-12-01 00:00:01','2005-11-21 00:00:01'),(5,'Rajon','Rondo','RajonRondo','1986-02-22','2001-02-01 00:00:01','2002-01-01 00:00:01'); +/*!40000 ALTER TABLE `users` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2015-03-19 16:48:20