sudo apt-get install python3-pip
sudo pip3 install virtualenv
import java.util.Random; | |
/** | |
* | |
* @author Vijini | |
*/ | |
//Main class | |
public class SimpleDemoGA { |
#!/usr/bin/env bash | |
DEPLOY_PATH=/tmp/heroku-deploy-`date +%s`/ | |
HEROKU_NAME="put-your-heroku-service-name-here" | |
rm -rf $DEPLOY_PATH | |
mkdir -p $DEPLOY_PATH | |
rsync -av . $DEPLOY_PATH --exclude node_modules | |
cd $DEPLOY_PATH |
# To incorporate and learn from later: http://stackoverflow.com/questions/494594/how-to-write-the-fibonacci-sequence-in-python | |
########################################## | |
# Method 1: Simple For Loops | |
# If you like, you can specify which Python version you are using | |
# Python 2 Version | |
# (xrange doesnt exist in Python3) | |
a, b = 0, 1 | |
for i in xrange(0, 10): |
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/ | |
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch | |
// async function | |
async function fetchAsync () { | |
// await response of fetch call | |
let response = await fetch('https://api.github.com'); | |
// only proceed once promise is resolved | |
let data = await response.json(); | |
// only proceed once second promise is resolved |
from flask_sqlalchemy import SQLAlchemy | |
from flask import Flask | |
app = Flask(__name__) | |
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///drinks.db' | |
db = SQLAlchemy(app) | |
class DrinkIngredient(db.Model): | |
id = db.Column(db.Integer, primary_key=True) |
from .user import User | |
def init_db(db): | |
"""Add a save() function to db.Model""" | |
def save(model): | |
db.session.add(model) | |
db.session.commit() | |
db.Model.save = save |