Skip to content

Instantly share code, notes, and snippets.

View gladson's full-sized avatar
😎
Vá lutar pelo que você acredita.

Gladson gladson

😎
Vá lutar pelo que você acredita.
View GitHub Profile
@gladson
gladson / date_range.py
Created September 27, 2012 00:24 — forked from felipe-prenholato/date_range.py
Date Range widget and field.
# -*- coding: utf-8 -*-
#
# This code have contributions of Augusto Men (https://github.com/augustomen)
# and Nando Florestan (https://github.com/nandoflorestan)
#
from __future__ import (absolute_import, division, unicode_literals)
from datetime import date
@gladson
gladson / bootstrap-recaptcha.css
Created October 1, 2012 15:46 — forked from boh1996/bootstrap-recaptcha.css
Twitter Bootstrap reCAPTCHA
.input-recaptcha {
width:172px;
}
@gladson
gladson / forms.py
Created October 2, 2012 15:44 — forked from macndesign/forms.py
Validação e formatação para campo localidade com cidade e estado juntos (Fortaleza - CE).
from core.validators import format_locality, validate_locality
class ClientForm(forms.ModelForm):
...
...
locality = forms.CharField(
help_text=u'Local da sede principal do cliente. Ex: São Paulo - SP',
validators=[validate_locality],
)
...
@gladson
gladson / gist:3906042
Created October 17, 2012 15:06 — forked from rafaelchagasb/gist:3845490
Filtro de municípios por estados - Django 1.3
/* >>>>>>>>>>>>>>> models.py <<<<<<<<<<<<< */
from django.db import models
class MeuModelo(models.Model):
estado = models.ForeignKey('Estado')
cidade = models.ForeignKey('Cidade')
class Pais(models.Model):
@gladson
gladson / baseviews.py
Created October 22, 2012 18:40 — forked from fabiocerqueira/baseviews.py
SearchView
from django.views.generic import ListView
from django.views.generic.edit import FormMixin
from django.db.models import Q
class SearchView(FormMixin, ListView):
template_name_suffix = '_search'
filter_operator = 'contains'
allow_or_operator = False
def get_filter_operator(self):
@gladson
gladson / registro.py
Created October 23, 2012 18:43 — forked from macndesign/registro.py
registro de usuario e userprofile
# forms.py
class UserProfileForm(forms.ModelForm):
class Meta:
model = UserProfile
exclude = ('user',)
class UserForm(UserCreationForm):
def __init__(self, *args, **kwargs):
super(UserForm, self).__init__(*args, **kwargs)
@gladson
gladson / DD_belatedPNG.js
Created November 1, 2012 02:21 — forked from donut/DD_belatedPNG.js
Fix PNGs in IE < 9 jQuery plugin
/* The code below should be included in a separate file using IE conditional comments
as it causes errors in IE8(+?) */
/**
* DD_belatedPNG: Adds IE6 support: PNG images for CSS background-image and HTML <IMG/>.
* Author: Drew Diller
* Email: [email protected]
* URL: http://www.dillerdesign.com/experiment/DD_belatedPNG/
* Version: 0.0.8a
* Licensed under the MIT License: http://dillerdesign.com/experiment/DD_belatedPNG/#license
@gladson
gladson / atepassar_recommender.py
Created November 1, 2012 15:55 — forked from marcelcaraciolo/atepassar_recommender.py
Atepassar Simple Algorithm for Friends Recommendation
#-*-coding: utf-8 -*-
'''
This module represents the FriendsRecommender system for recommending
new friends based on friendship similarity and state similarity.
'''
__author__ = 'Marcel Caraciolo <[email protected]>'
@gladson
gladson / json_response.py
Created November 29, 2012 14:25 — forked from macndesign/json_response.py
Serializar detalhamento ou listagem de dados customizados em json com CBV
# API JSON
from django.http import HttpResponse
from django.utils import simplejson
from django.views.generic.detail import BaseDetailView
from django.views.generic.list import BaseListView
from django.db.models.query import QuerySet
class JSONResponseMixin(object):
def render_to_response(self, context):
return self.get_json_response(self.convert_context_to_json(context))
@gladson
gladson / configuration.php
Created December 11, 2012 04:00
example configuration file for running Joomla on AppFog
<?php
class JConfig {
/* Site Settings */
public $offline = '0';
public $offline_message = 'This site is down for maintenance.<br /> Please check back again soon.';
public $sitename = '';
public $editor = 'tinymce';
public $list_limit = '10';
public $legacy = '0';
/* Debug Settings */