Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

changed stuff

  • Loading branch information...
commit c7c48ab69aeb891f1f2e6959483bcdb063ac6a3b 1 parent 28dad8b
Daria Jung authored
View
22 babies.py
@@ -4,20 +4,22 @@
import search
app = Flask(__name__)
-@app.route('/', methods=['GET', 'POST'])
+@app.route('/')
def index():
- spermcount = search.searching("Justin Bieber")
- return render_template('index.html')
+ spermcount = search.searching("Justin Bieber")
+ return render_template('index.html')
-app.route('/',methods=['GET','POST'])
+@app.route('/search')
def print_form():
- if request.method == 'POST':
- return render_template('index.html')
+ print "0hello world!"
if request.method == 'GET':
- print render_template('index.html',result=request.form['spermcount'])
- return render_template('index.html',result=request.form['spermcount'])
+ name = request.args.get('spermcount')
+ print name
+ print "1hello world!"
+ print render_template('index.html',result = request.args['spermcount'])
+ return render_template('index.html',result = request.args['spermcount'])
if __name__ == '__main__':
- port = int(os.environ.get('PORT', 5000))
- app.run(host='0.0.0.0', port=port)
+ port = int(os.environ.get('PORT', 5000))
+ app.run(host='0.0.0.0', port=port)
View
BIN  templates/.DS_Store
Binary file not shown
View
2  templates/index.html
@@ -19,7 +19,7 @@
<br></br>
<img src ="static/logo.png">
-<form class="form-wrapper cf">
+<form action = "/search" class="form-wrapper cf">
<input name="spermcount" type="text" placeholder="Search for a celeb here..." required>
<button type="submit">have my babies!</button>
</form>
View
110 templates/index2.html
@@ -1,110 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.29.1"></script>
- <style type="text/css">
-
-body {
- background: #000;
-}
-
-ellipse {
- fill: #fff;
-}
-
-path {
- fill: none;
- stroke: #fff;
- stroke-linecap: round;
-}
-
-.mid {
- stroke-width: 4px;
-}
-
-.tail {
- stroke-width: 2px;
-}
-
- </style>
- </head>
- <body>
- <script type="text/javascript">
-
-var w = 960,
- h = 500,
- n = 10, <!--Sperm count!-->
- m = 12,
- degrees = 180 / Math.PI;
-
-var spermatozoa = d3.range(n).map(function() {
- var x = Math.random() * w, y = Math.random() * h;
- return {
- vx: Math.random() * 2 - 1,
- vy: Math.random() * 2 - 1,
- path: d3.range(m).map(function() { return [x, y]; }),
- count: 0
- };
-});
-
-var svg = d3.select("body").append("svg:svg")
- .attr("width", w)
- .attr("height", h);
-
-var g = svg.selectAll("g")
- .data(spermatozoa)
- .enter().append("svg:g");
-
-var head = g.append("svg:ellipse")
- .attr("rx", 6.5)
- .attr("ry", 4);
-
-g.append("svg:path")
- .map(function(d) { return d.path.slice(0, 3); })
- .attr("class", "mid");
-
-g.append("svg:path")
- .map(function(d) { return d.path; })
- .attr("class", "tail");
-
-var tail = g.selectAll("path");
-
-d3.timer(function() {
- for (var i = -1; ++i < n;) {
- var spermatozoon = spermatozoa[i],
- path = spermatozoon.path,
- dx = spermatozoon.vx,
- dy = spermatozoon.vy,
- x = path[0][0] += dx,
- y = path[0][1] += dy,
- speed = Math.sqrt(dx * dx + dy * dy),
- count = speed * 10,
- k1 = -5 - speed / 3;
-
- // Bounce off the walls.
- if (x < 0 || x > w) spermatozoon.vx *= -1;
- if (y < 0 || y > h) spermatozoon.vy *= -1;
-
- // Swim!
- for (var j = 0; ++j < m;) {
- var vx = x - path[j][0],
- vy = y - path[j][1],
- k2 = Math.sin(((spermatozoon.count += count) + j * 3) / 300) / speed;
- path[j][0] = (x += dx / speed * k1) - dy * k2;
- path[j][1] = (y += dy / speed * k1) + dx * k2;
- speed = Math.sqrt((dx = vx) * dx + (dy = vy) * dy);
- }
- }
-
- head.attr("transform", function(d) {
- return "translate(" + d.path[0] + ")rotate(" + Math.atan2(d.vy, d.vx) * degrees + ")";
- });
-
- tail.attr("d", function(d) {
- return "M" + d.join("L");
- });
-});
-
- </script>
- </body>
-</html>
Please sign in to comment.
Something went wrong with that request. Please try again.