Skip to content

Instantly share code, notes, and snippets.

RNB Developer rodrigobertin

Block or report user

Report or block rodrigobertin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View paginator_flask_render.py
def paginator(page, pagination):
try:
rend = """
<ul class="pagination">
{% if page > 1 %}
<li><a href="?page={{ page - 1 }}"><i class="fa fa-chevron-left"></i></a></li>
{% endif %}
{% for p in range(pagination.get_page_count()) %}
<li><a href="?page={{ p + 1 }}">{{ p + 1 }}</a></li>
@rodrigobertin
rodrigobertin / upload_images.py
Created Aug 22, 2019
Upload multiple images
View upload_images.py
def upload_images(upload_folder, input_name='image'):
"""
Upload images with flask
:param multiple:
:param upload_folder:
:param input_name:
:return:
"""
from werkzeug.utils import secure_filename
import os
View responsive_table.js
$('table').each(function () {
let This = $(this);
let lista = [];
This.find('th').each(function (index) {
console.log(index);
let Th = $(this);
let text = Th.text();
lista.push(text);
});
@rodrigobertin
rodrigobertin / back_database.sh
Created Aug 6, 2019
Backup database postgres with docker
View back_database.sh
#!/usr/bin/env bash
export BASE=$(pwd)
export PASS=<pass>
export FILE=database.dump
export FILE_ST=database_st.dump
export DATABASE=<datbase>
export USER=<postgres>
export HOST_REMOTE=<remote>
echo '---------------> EXPORT DUMP Complete'
View data.js
$('table').each(function () {
let This = $(this);
let lista = [];
This.find('th').each(function (index) {
console.log(index);
let Th = $(this);
let text = Th.text();
lista.push(text);
});
@rodrigobertin
rodrigobertin / MercadopagoCheckot.py
Last active Jul 4, 2019
Mercadopago Checkout with python
View MercadopagoCheckot.py
import os
import sys
import hashlib
import mercadopago
from flask import current_app as app, render_template_string, request
class MercadoPagoCheck:
url_checkout = None
url_checkout_sandbox = None
@rodrigobertin
rodrigobertin / form_loop.py
Created Jul 1, 2019
Form loop flask peewe
View form_loop.py
def form_loop(form, show_label=False):
try:
rend = u"""
{{ form.hidden_tag() }}
{% for field in form if field.widget.input_type !='hidden' %}
<fieldset data-iden="{{ field.name }}">
{% if show_label %}
{{ field.label }}
{% endif %}
@rodrigobertin
rodrigobertin / upload_images_flask.py
Last active Sep 5, 2019
Upload images with Flask
View upload_images_flask.py
def upload_image(upload_folder, input_name='image'):
"""
Upload images with flask
:param upload_folder:
:param input_name:
:return:
"""
from werkzeug.utils import secure_filename
import os
import random
View range_date.py
from datetime import timedelta, date
def daterange(date1, date2):
for n in range(int ((date2 - date1).days)+1):
yield date1 + timedelta(n)
start_dt = date(2015, 12, 20)
end_dt = date(2016, 1, 11)
for dt in daterange(start_dt, end_dt):
print(dt.strftime("%Y-%m-%d"))
View post-receive.sh
#!/bin/bash
export GIT_WORK_TREE=/mnt/websites/sites/AdminPanelRNB/WEBSITES/escueladeskate.com.ar #Carpeta publica donde se copian los archivos
export GIT_DIR=/mnt/websites/sites/AdminPanelRNB/REPOS/escueladeskate.com.ar.git #Carpeta del repositorio git
echo "-------------------------------------------------------------------------->"
echo "--------------------- Actualizando Rama MASTER --------------------------->"
echo "-------------------------------------------------------------------------->"
git --work-tree=$GIT_WORK_TREE --git-dir=$GIT_DIR checkout -f
echo "-------------------------------------------------------------------------->"
You can’t perform that action at this time.