Skip to content

Instantly share code, notes, and snippets.

View hersonls's full-sized avatar

Herson Leite hersonls

View GitHub Profile
@hersonls
hersonls / settings.json
Last active May 8, 2020 18:19
My VSCODE config
{
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"editor.snippetSuggestions": "top",
"editor.minimap.enabled": false,
"python.jediEnabled": false,
"workbench.editor.enablePreview": false,
"workbench.editor.enablePreviewFromQuickOpen": false,
"vtools.autoHideSideBar": true,
"vtools.autoHideDelay": 200,
@hersonls
hersonls / .zshrc
Created February 26, 2016 17:35
Auto load python virtual env and rename tmux window using zsh
# chpwd is a zsh hook, wich is executed after change directory
# More info: http://zsh.sourceforge.net/Doc/Release/Functions.html
function chpwd() {
if [ -z "$VIRTUAL_ENV" ]; then
# If exists a virtualenv with name of directory, load it!
workon ${PWD##*/} 2> /dev/null
else
# If a virtual env are loaded, rename window with they name
TMUX_WINDOW_NAME=$(tmux display-message -p '#W')
if [ $TMUX_WINDOW_NAME != ${VIRTUAL_ENV##*/} ]; then
@hersonls
hersonls / form.json
Last active August 29, 2015 14:14
Retorno de formulário em ajax
{
// true ou false, caso esteja com sucesso ou nao
"success": false,
// Mandar apenas se houver erros
"errors": {
"campo": "erro",
"campo": "erro",
"campo": "erro",
"campo": "erro",
@hersonls
hersonls / .tmux.conf
Created November 26, 2014 15:27
Tmux: Personal tmux settings
unbind %
bind | split-window -h
bind _ split-window -v
# Patch for OS X pbpaste and pbcopy under tmux.
set-option -g default-command "which reattach-to-user-namespace > /dev/null && reattach-to-user-namespace -l $SHELL || $SHELL"
# Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
@hersonls
hersonls / base_site.html
Created August 3, 2014 02:37
Adding current site name to django admin title
{% extends "admin/base.html" %}
{% block title %}{{ title }} | {{ site.name }}{% endblock %}
{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">{{ site_header|default:_('Django administration') }}</a></h1>
{% endblock %}
{% block nav-global %}{% endblock %}
@hersonls
hersonls / __init__.py
Created February 8, 2014 03:24
Flask: Blueprint example
from flask import Blueprint
from urls import url_rules
bp = Blueprint(__name__.split('.')[1], __name__, template_folder='templates')
for url_rule in url_rules:
url_regex, view_func = url_rule
bp.add_url_rule(url_regex, view_func=view_func, methods=['GET', 'POST'])
@hersonls
hersonls / blueprints.py
Created February 8, 2014 03:23
Flask: Load blueprints from given path
import os
from importlib import import_module
from flask.blueprints import Blueprint
def load_blueprints_from_path(app, packages_path, blueprint_name='bp'):
blueprints = []
@hersonls
hersonls / ajax_events.js
Created October 9, 2013 18:44
JavaScript: Listening all ajax events
!function ($) {
var logEvent = function(event) {
$('.notifier').append('<p>'+event+'</p>');
}
$(document).ajaxStart(onStart)
.ajaxStop(onStop)
.ajaxSend(onSend)
.ajaxComplete(onComplete)
.ajaxSuccess(onSuccess)
@hersonls
hersonls / clearfix.css
Created July 17, 2013 17:03
CSS: Clearfix
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
.clearfix { display: inline-block; }
* html .clearfix { height: 1%; }
..:77I777777777777777777777I. .
..?77777777777777777777777777777$+..
. ~7777777I7777777777777777777777777$~..
.7I7777...7777777777777777777777777$7+.
.?7777.. ..77777777777777777777777$$7.
.77777 777777777777777777777$$$$$I
.77777.. ...7777777777777777777$$$$$$$$
.7777777 .77$777777777777777777$$$$$$$$
.77777777777777777777777777777$$$$$$$$$$
.77777777777777777777777777$$$$$$$$$$$$$