Skip to content

Instantly share code, notes, and snippets.

View gilsondev's full-sized avatar
💼
Work

Gilson Filho gilsondev

💼
Work
View GitHub Profile
@flavianmissi
flavianmissi / json_response_generic_view.py
Created December 13, 2011 17:57
Simple json response generic view
from django.views.generic import View
from django.utils import simplejson
class JSONResponseView(View):
def render_to_response(self, data, **httpresponse_kwargs):
"Retuns a json response based on the context"
json_data = simplejson.dumps(data)
return HttpResponse(json_data, content_type="application/json", **httpresponse_kwargs)
@henriquebastos
henriquebastos / formrange.py
Created December 27, 2011 16:59
Snippet para demonstrar validação de um form com range e valor entre eles.
from django import forms
from django.test import RequestFactory
class RangeForm(forms.Form):
min = forms.IntegerField()
max = forms.IntegerField()
valor = forms.IntegerField()
def clean(self):
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@tapajos
tapajos / gist:1811460
Created February 12, 2012 23:05
Migrando do Heroku para a Amazon Web Services

Migrando do Heroku para a Amazon Web Services

Recentemente eu comentei sobre a migração que fizemos no [Myfinance][mf] saindo do [Heroku][h] e indo para a [Amazon Web Services][a] e diversas pessoas me perguntaram as razões pela qual fizemos essa mudança. O objetivo desse post é apenas explicar a decisão que a nossa equipe tomou, como foi e as conseguências dessa migração.

Antes de começar eu gostaria de deixar claro que o objetivo desse texto não é comparar hospedagens e nem dizer que uma é melhor do que a outra. Trata-se apenas do relato de uma experiência.

A motivação

Antes de explicar a motivação por trás da migração é interessante mostrar como era a nossa estrutura.

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@douglasmiranda
douglasmiranda / gist:1973844
Created March 4, 2012 16:50
Install PIL with JPEG and PNG support in WebFaction. Just in case the "pip install PIL" not solve the problem in your shared host.
# Download
wget http://effbot.org/media/downloads/PIL-1.1.7.tar.gz
tar zxf PIL-1.1.7.tar.gz
cd PIL-1.1.7
# Edit setup file
vim setup.py
# Set the following variables
JPEG_ROOT = '/usr/lib64','/usr/include'
ZLIB_ROOT = '/lib64','/usr/include'
@amacdougall
amacdougall / focus.vim
Created March 6, 2012 23:38
Simple vim script for a single centered text column.
" Name: focus.vim
" Author: Alan MacDougall <[email protected]>
" License: Public Domain
"
" Focus on a single column of text, showing it in a distraction-free format.
" Save this as ~/.vim/scripts/focus.vim (or whatever you please), and invoke
" it with :source <filename>. Of course, you could certainly hook that up to a
" :command, or a macro, or a Vimscript function...
" collapse current splits and divide screen in three
@xsalefter
xsalefter / pom.xml
Created March 20, 2012 04:37
pom.xml for maven + jpa 2 + ejb3.1 + cdi + jsf 2
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.projectboard</groupId>
<artifactId>projectboard</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Project Board</name>
<description>Project management dashboard.</description>
@eyeseast
eyeseast / gist:2172461
Created March 23, 2012 16:28
LESS + Django Compressor
{# via http://www.caktusgroup.com/blog/2012/03/05/using-less-django/ #}
{% load compress %}
{% if debug %}
// This is the client-side way to compile less and an ok choice for local dev
<link rel="stylesheet/less" type="text/css" media="all" href="{{ STATIC_URL }}less/style.less" />
<script src="{{ STATIC_URL }}js/less-1.1.3.min.js"></script>
{% else %}
{% compress css %}
@Calvein
Calvein / Custom.css
Created March 23, 2012 20:24
Solarized Dark Skin for the Chrome DevTools
body#-webkit-web-inspector #main{background-color:#002b36!important}body#-webkit-web-inspector #main .panel.network,body#-webkit-web-inspector #main .panel.timeline,body#-webkit-web-inspector #main .panel.profiles,body#-webkit-web-inspector #main .panel.audits,body#-webkit-web-inspector #main .panel.extension{background-color:#fff!important}body#-webkit-web-inspector #console-messages a:hover,body#-webkit-web-inspector #console-messages .console-formatted-function,body#-webkit-web-inspector #console-messages .console-formatted-object{color:#93a1a1!important}body#-webkit-web-inspector #console-prompt,body#-webkit-web-inspector #console-messages a,body#-webkit-web-inspector #console-messages .console-message,body#-webkit-web-inspector #console-messages .console-group-messages .section .header .title{color:#839496!important}body#-webkit-web-inspector #console-messages .console-formatted-null,body#-webkit-web-inspector #console-messages .console-formatted-undefined{color:#657b83!important}body#-webkit-web-inspect