Skip to content

Instantly share code, notes, and snippets.

View camilonova's full-sized avatar

Camilo Nova camilonova

View GitHub Profile
@camilonova
camilonova / import_data.py
Created November 1, 2014 19:27
Example on how to import data with images using pyquery into a django model
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Author: AxiaCore S.A.S. http://axiacore.com
import urllib2
from django.core.files.base import ContentFile
from django.core.management.base import BaseCommand
from django.core.management.base import CommandError
from store.models import Application
@camilonova
camilonova / _retina-sprite-mixins.sass
Created December 2, 2014 21:38
Compass retina sprite background
// Retina Sprite Mixins
@mixin retina-sprite-background($name)
background-repeat: no-repeat
background-image: sprite-url($sprite-normal)
background-position: sprite-position($sprite-normal, $name)
height: image-height(sprite-file($sprite-normal, $name))
width: image-width(sprite-file($sprite-normal, $name))
// Media Query for retina
@camilonova
camilonova / base.html
Created March 23, 2015 10:35
Alert message for older browsers
<!--[if lt IE 9]>
<div class="alert-browser">
Oops! Parece que estás usando un navegador obsoleto. Por favor <a href="http://browsehappy.com/?locale=es_ES">actualiza tu navegador</a> para mejorar tu experiencia en la web.
</div>
<![endif]-->
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)%Creset' --abbrev-commit
ac = "!git add . && git commit -am"
patch = "!bumpversion --tag --commit patch package.json bower.json"
minor = "!bumpversion --tag --commit minor package.json bower.json"
mayor = "!bumpversion --tag --commit mayor package.json bower.json"
[push]
default = matching
from django import template
from django.http import Http404
from django.conf import settings
register = template.Library()
DEFAULT_SORT_UP = getattr(settings, 'DEFAULT_SORT_UP' , '&uarr;')
DEFAULT_SORT_DOWN = getattr(settings, 'DEFAULT_SORT_DOWN' , '&darr;')
INVALID_FIELD_RAISES_404 = getattr(settings,
'SORTING_INVALID_FIELD_RAISES_404' , False)
@camilonova
camilonova / .profile
Created January 28, 2012 16:16
OSX Lion .profile file
# Virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
# Color
export TERM=xterm-color
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
# Bash completion
@camilonova
camilonova / models.py
Created February 8, 2012 13:05
Comment tree model
class Comment(models.Model):
"""
Representa los comentarios a los posts del blog
"""
post = models.ForeignKey(
'blog.Post',
)
user = models.ForeignKey(
'auth.User',
)
@camilonova
camilonova / settings.py
Created June 25, 2012 20:36
Default logging for django 1.4
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'console': {
@camilonova
camilonova / .bash_profile
Last active November 20, 2015 16:00
Bash profile osx lion
# Locale
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# Homebrew
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH"
# Brew autocomplete
source `brew --prefix`/Library/Contributions/brew_bash_completion.sh
@camilonova
camilonova / styles.sass
Created December 11, 2015 14:45
Bourbon Modal
.modal
$base-border-color: #dcdcdc !default
$base-border-radius: 3px !default
$base-background-color: #fff !default
$base-font-size: 1em !default
$base-line-height: 1.5em !default
$action-color: #477dca !default
$dark-gray: #333 !default
$light-gray: #ddd !default
$medium-screen: em(640) !default