This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import random | |
import copy | |
class Game(): | |
def __init__(self): | |
self.board = [" "] * 9 | |
self.playing_board = copy.deepcopy(self.board) | |
self.player1 = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
#listen 80; | |
index index.html index.php; | |
## Begin - Server Info | |
root /var/www/; | |
server_name grav; | |
## End - Server Info | |
## Begin - Index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Función para convertir el custom_field('xx') en un excerpt de 50 palabras máximo | |
function get_athelas_custom_field_excerpt($title, $chars) { | |
global $post; | |
$text = get_field($title); | |
if ( '' != $text ) { | |
$text = strip_shortcodes( $text ); | |
$text = apply_filters('the_content', $text); | |
$text = str_replace(']]>', ']]>', $text); | |
$excerpt_length = $chars; // in words | |
$excerpt_more = apply_filters('excerpt_more', ' ' . '...'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
edis_1 | [1] 20 Dec 22:51:18.478 * Background saving started by pid 14 | |
redis_1 | [14] 20 Dec 22:51:18.562 * DB saved on disk | |
redis_1 | [14] 20 Dec 22:51:18.564 * RDB: 6 MB of memory used by copy-on-write | |
redis_1 | [1] 20 Dec 22:51:18.579 * Background saving terminated with success | |
postgres_1 | ERROR: role "catwatch" already exists | |
postgres_1 | STATEMENT: CREATE USER catwatch WITH PASSWORD 'bestpassword' | |
postgres_1 | ERROR: role "catwatch" already exists | |
postgres_1 | STATEMENT: CREATE USER catwatch WITH PASSWORD 'bestpassword' | |
redis_1 | [1] 20 Dec 23:41:20.277 * 100 changes in 300 seconds. Saving... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def resize_and_crop(img_path, modified_path, size, crop_type='top'): | |
""" | |
Resize and crop an image to fit the specified size. | |
args: | |
img_path: path for the image to resize. | |
modified_path: path to store the modified image. | |
size: `(width, height)` tuple. | |
crop_type: can be 'top', 'middle' or 'bottom', depending on this | |
value, the image will cropped getting the 'top/left', 'middle' or |
OlderNewer