Skip to content

Instantly share code, notes, and snippets.

View cantoniazzi's full-sized avatar

Cássio Antoniazzi cantoniazzi

View GitHub Profile
$(document).on("click", ".btn-remove", function() {
var id = $(this).attr("data-id");
var uri = '/sua-rota-de-remocao-de-registros';
$.ajax({
type: "POST",
url: uri,
success: function (data) {
// aqui entra sua lógica de ocultar o elemento removido
}
'''
Author: Cássio Antoniazzi
email: [email protected]
'''
months = {}
months[1] = 31
months[2] = 28
months[3] = 31
months[4] = 30
@cantoniazzi
cantoniazzi / .gitignore
Created March 29, 2018 19:53
A python gist example to settings with environments. You must create a file called settings.cfg at the root of your project and put their keys in this file. It will not be committed to the repository.
settings.cfg
@cantoniazzi
cantoniazzi / form_errors.html
Created April 11, 2018 00:05
A gist that displays in the template a form of global iteration of form validation errors in a flask application.
{% if form.errors %}
{% for field in form.errors %}
{% for error in form.errors[field] %}
<div class="alert alert-danger">
<small class="text-danger">
<strong>Error:</strong> {{ error }}
</small>
</div>
{% endfor %}
{% endfor %}
@cantoniazzi
cantoniazzi / kafkaClient.js
Created April 24, 2018 00:56
A kafka client in nodejs.
'use strict';
const uuidv4 = require('uuid/v4');
const kafka = require('kafka-node'),
Producer = kafka.Producer,
client = new kafka.KafkaClient({kafkaHost: 'KAFKA_HOST_HERE'}),
producer = new Producer(client);
producer.on("ready", function () {
@cantoniazzi
cantoniazzi / gist:f0a5b7a4dd98de83984c46e84fd0aeb7
Created July 5, 2018 01:22 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@cantoniazzi
cantoniazzi / presto_conn_example.py
Last active September 22, 2020 17:15
presto connection with python
from pyhive import presto
from pandas import read_sql
def get_presto_conn():
return presto.connect(host='YOUR_PRESTO_HOST', username='YOUR_PRESTO_USERNAME', port='YOUR_PRESTO_PORT')
def get_query_result(presto_conn):
query = 'YOUR_QUERY_HERE'
@cantoniazzi
cantoniazzi / create_pdf.py
Last active September 19, 2024 09:25
creating pdf with python and jinja
from jinja2 import Environment
from jinja2 import FileSystemLoader
from pdfkit import from_string
def create_pdf():
template_vars = {
'template_title': 'A template example',
'template_description': 'Lorem ipsum dolor sit amet, consectetur adipisicing elit'
}