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.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>
View SmoothScroll.js
document.querySelectorAll('header a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
View upgrade_pip.sh
#!/usr/bin/env bash
export CURRENT=$(pwd)
cd ${CURRENT}
echo ""
echo "---------------------------------------->"
echo "Current directory ${CURRENT}"
echo "---------------------------------------->"
echo ""
View user_ftp.sh
sudo adduser webadmin
usermod -a -G webadmin www-data
usermod -a -G www-data webadmin
@rodrigobertin
rodrigobertin / sync_db.sh
Created Sep 24, 2019
Sync Database postgres
View sync_db.sh
#!/usr/bin/env bash
export DIR=$(pwd)
export PASS=PASS_DB
export FILE=database.dump
export FILE_ST=database_st.dump
export DATABASE=enjoy
export USER=enjoy
export HOST_REMOTE=dbs.enjoybahia.com.ar
echo '---------------> EXPORT DUMP Complete'
@rodrigobertin
rodrigobertin / convert_to_dict.py
Created Sep 17, 2019
Convert to dict, pewee raw sql
View convert_to_dict.py
def convert_to_dict(cursor):
column_names = [x[0] for x in cursor.description]
all_tables = [dict(zip(column_names, row)) for row in cursor.fetchall()]
return all_tables
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'
You can’t perform that action at this time.