Skip to content

Instantly share code, notes, and snippets.

View ondoheer's full-sized avatar

Pedro Baumann ondoheer

  • Athelas Perú
  • Lima - Perú
View GitHub Profile
@ondoheer
ondoheer / game.py
Last active October 12, 2015 13:27
Tic Tac toe Implementation against player and AI, AI not yet implemented
import sys
import random
import copy
class Game():
def __init__(self):
self.board = [" "] * 9
self.playing_board = copy.deepcopy(self.board)
self.player1 = {
@ondoheer
ondoheer / send_mail.py
Created April 27, 2015 03:25
Trouble sending mail asynchronously
@main.route("/mail/<int:_id>/<int:number>")
@login_required
def mailSession(_id, number):
from flask_mail import Message
from decorators import async
from app import mail, create_app
@ondoheer
ondoheer / gist:70c739a32245024cfadf
Created April 8, 2015 17:44
Sqlalchemy tutorial code
from sqlalchemy import create_engine
#in memory only sqlite db
engine = create_engine('sqlite:///demo.db', echo=True)
# Lazy Connecting
# The Engine, when first returned by create_engine(), has not actually tried to connect to the database yet; that happens only the first time it is asked to perform a task against the database.
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
<?php
// Check for empty fields
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['phone']) ||
empty($_POST['message']) ||
!filter_var($_POST['email'],FILTER_VALIDATE_EMAIL))
{
echo "No arguments Provided!";
return false;
server {
# Running port
listen 80;
server_name pedroyluciasecasan.com www.pedroyluciasecasan.com; #nombre del dominio(s) que debe asociar a esa ruta
#logs (logs independientes para la web, las carpetas de la ruta DEBEN existir)
access_log /var/www/logs/pedroyluciasecasan.com/access.log;
error_log /var/www/logs/pedroyluciasecasan.com/error.log;
@ondoheer
ondoheer / Index function
Created November 20, 2014 20:19
Flask-Stormpath-Wedding login function
@frontend.route('/')
@frontend.route('/index')
@login_required
@pony.db_session
def index():
# We check if the user exists in the database we load it,
# otherwise we create a new one.
user_id = user.get_id()