text Youtube缩略图网址

youtube-urls

http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg
The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of 1.jpg, 2.jpg, 3.jpg) is:

http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg
For the high quality version of the thumbnail use a url similar to this:

http://img.youtube.com/vi/<insert-youtube-video-id-here>/hqdefault.jpg
There is also a medium quality version of the thumbnail, using a url similar to the HQ:

http://img.youtube.com/vi/<insert-youtube-video-id-here>/mqdefault.jpg
For the standard definition version of the thumbnail, use a url similar to this:

http://img.youtube.com/vi/<insert-youtube-video-id-here>/sddefault.jpg
For the maximum resolution version of the thumbnail use a url similar to this:

http://img.youtube.com/vi/<insert-youtube-video-id-here>/maxresdefault.jpg

text HTML Bullet Point

bullet-point
••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

text 动量滚动

scrolling
overflow-y:scroll;/* has to be scroll, not auto */-webkit-overflow-scrolling:touch;

text Youtube控制

youtube-controls
?autoplay=0&controls=1&autohide=1&showinfo=0&rel=0

text Flask路由参数/条件

在url中使用条件/参数路由Flask的示例

fparamurl
from flask import Flask,jsonify,request
app = Flask(__name__)

@app.route("/".methods=["GET", "POST"])

def index():
  if request.method == "POST"):
    #validate post data
    #response code specified, usually would be 200 for success
    return jsonify({"you sent": some_json}), 201
  else:
    #was a read request not a write one
    return jsonify({"about":"Hello World"})
    
#get parameter from url and multiply it by 10 - users can only use GET to this address
app.route{"multi/<int:num>", methods=["GET"])
def multiply10(num):
  return jsonify({"result":num*10})

#If flask available and loaded to default first module
if __name__ == "__main__":
  #run the program and start the service
  app.run(debug=True)
      

text JS

js
var sep = function(str) {
    var parts = (str + '').split('.'),
        main = parts[0],
        len = main.length,
        output = '',
        i = len - 1;

    while(i >= 0) {
        output = main.charAt(i) + output;
        if ((len - i) % 3 === 0 && i > 0) {
            output = ',' + output;
        }
        --i;
    }

    if (parts.length > 1) {
        output += '.' + parts[1];
    }
    return output;
};

text 有用的图书馆/链接

Flask库名称以及如何使用它们的链接

useful
#Useful Plugins
Flask-PyMongo - http://readthedocs.org/docs/flask-pymongo/
Flask-SQLAlchemy - http://pypi.python.org/pypi/Flask-SQLAlchemy
Flask-WTF - http://pythonhosted.org/Flask-WTF/
Flask-Mail - http://pythonhosted.org/Flask-Mail/
FLask-RESTFul - https://flask-restful.readthedocs.org/
Flask-Uploads - https://flask-uploads.readthedocs.org/en/latest/
Flask-User - http://pythonhosted.org/Flask-User/
FLask-Login - http://pythonhosted.org/Flask-Login/
Flask-HTTPAuth - RESTful authentication
Flask-SocketIO - Websocket communicaiton
Flask-CORS - https://flask-cors.readthedocs.io/en/latest/api.html

#Useful Links
Flask Website - http://flask.pocoo.org
Flask MySQL documentation - http://flask-mysqldb.readthedocs.io/en/latest/
Pretty Printed Website - http://prettyprinted.com
Pretty Pretty YouTube Channel -
https://www.youtube.com/c/prettyprintedtutorials

text 会话处理

在Flask中处理会话的代码

fsession
#Session Handling
import session
app.config['SECRET_KEY'] = 'any random string' #must be set to use sessions
#set session
@app.route('/login_success')
def login_success():
 session['key_name'] = 'key_value' #stores a secure cookie in browser
 return redirect(url_for('index'))
#read session
@app.route('/')
def index():
 if 'key_name' in session: #session exists and has key
 session_var = session['key_v

text 设置Cookie

为烧瓶路线设置饼干

FCookies
#Set Cookie
from flask import make_response
@app.route('/')
def index():
 resp = make_response(render_template('index.html'))
 resp.set_cook

text 退出

中止路由,并将其重新路由到另一个页面

Fabort
#Abort
from flask import abort()
@app.route('/')
def index():
 abort(404) #returns 404 error
 render_template('index.html') #this never gets executed