Skip to content

Instantly share code, notes, and snippets.

View wm3ndez's full-sized avatar
🏠
Working from home

Williams Mendez wm3ndez

🏠
Working from home
View GitHub Profile
@wm3ndez
wm3ndez / form_wigets.py
Last active July 21, 2022 18:46
Add attrs to Django Form Fields. I've been using Twitter Bootstrap in a couple of my projects and I needed to add some attrs to my form fields. This is far away from perfect, but guess what: It works!
from django.template import Library
register = Library()
@register.filter
def add_classes(widget, classes):
widget.field.widget.attrs['class'] = classes
return widget
@wm3ndez
wm3ndez / bt2To3.py
Last active September 8, 2016 03:00
A little script made for replacing bootstrap2 classes with the new boostrap3 classes. There are more classes to add, but at this moment these are the ones I need.
import os
import re
import argparse
app_path = os.path.split(os.path.split(__file__)[0])[0]
PROJECT_ROOT = os.path.abspath(app_path)
regexps = [
(r'class=(["\'] *?)row-fluid(.*?["\']+)', r'class=\1row\2'),
(r'class=(["\'] *?)brand(.*?["\']+)', r'class=\1navbar-brand\2'),
@wm3ndez
wm3ndez / my_template.html
Created May 7, 2014 15:36
django simple_tag to get a thumbnail from "media/", using sorl-thumbail without adding the hostname
{% load mytemplatetags %}
<img src="{% get_thumbail_from_media 'my-image-inside-media-folder.png' '100x75' format='PNG' %}"/>
<!DOCTYPE html>
<html lang="en">
<head>
<title>WebSocket Client</title>
<style>
#output {
border: solid 1px #000;
}
</style>
</head>
# -*- coding: utf-8 -*-
# Estas cedulas fueron emitidas por la JCE, pero no cumplen con el
# digito verificador, por lo cual deben ser verificadas por separado.
import csv
import cPickle
__author__ = 'eneldoserrata'
excepcionesCedulas = ['00000000018', '11111111123', '00100759932', '00105606543', '00114272360', '00200123640',