Skip to content

Instantly share code, notes, and snippets.

View rayhaanj's full-sized avatar

Rayhaan Jaufeerally rayhaanj

View GitHub Profile
@rayhaanj
rayhaanj / gist:11183111
Created April 22, 2014 15:13
keybase.md
### Keybase proof
I hereby claim:
* I am rayhaanj on github.
* I am rayhaan (https://keybase.io/rayhaan) on keybase.
* I have a public key whose fingerprint is 5A65 1824 89C2 EDBF 5343 09E7 E1F3 C1BC 5B1A FE13
To claim this, I am signing this object:
@rayhaanj
rayhaanj / gist:8687167
Last active January 4, 2016 22:19
flask view function
@app.route('/add', methods=['POST'])
def add_entry():
if not session.get('logged_in'):
abort(401)
database_session.add( Item( "some data here" ) )
database_session.commit()
flash('New entry was successfully posted')
return redirect(url_for('show_entries'))
@rayhaanj
rayhaanj / gist:8687012
Created January 29, 2014 12:35
models
class User(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
username = Column(String(100), unique=True)
password = Column(String(100))
firstName = Column(String(100))
middleNames = Column(String(100))
@rayhaanj
rayhaanj / gist:8686781
Created January 29, 2014 12:16
sqlalchemy
from sqlalchemy import create_engine
engine = create_engine('sqlite:///:memory:', echo=True)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head> <title>My Webpage</title> </head>
<body>
<ul id="navigation">
{% for item in navigation %}
<li><a href="{{ item.href }}">{{ item.caption }}</a></li>
{% endfor %}
</ul>
<h1>My Webpage</h1> {{ a_variable }}
@rayhaanj
rayhaanj / gist:8673900
Created January 28, 2014 18:59
Simple flask app
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run(debug=True)