Skip to content

Instantly share code, notes, and snippets.

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

Rael Max raelmax

🏠
Working from home
View GitHub Profile
#!/bin/bash
# Checking if python is installed
if ! [ -x "$(command -v python)" ]; then
echo 'Error: python is not installed. :(' >&2
exit 1
fi
# Build directory
export OLDDIR=$PWD
@raelmax
raelmax / server.py
Created January 21, 2016 17:39
Python SimpleHTTPServer com sleep
import SimpleHTTPServer
import SocketServer
from time import sleep
PORT = 5000
SLEEP_TIME = 6
class SlowHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
@raelmax
raelmax / .vimrc
Last active August 16, 2016 15:32
Vim Config FIle
"""
" Vim Config File
"""
"NeoBundle Scripts-----------------------------
if has('vim_starting')
if &compatible
set nocompatible " Be iMproved
endif
" Required:
# status bar
set-option -g status-utf8 on
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default
# default window title colors
@raelmax
raelmax / notebooks.md
Created November 22, 2014 15:47
Notebooks que encontrei com bom custoXbenefício
@raelmax
raelmax / changecommits.sh
Created April 15, 2013 14:35
Change author/commiter info
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "your@wrong.email" ]
@raelmax
raelmax / django_template_tips.md
Last active December 14, 2015 19:18
Django template language tips.

Intro

When we work with frontend on django projects, we have to work with the django template language, some developers dislike, but i like so much and have some tips to improve this experience.

division on template with widthratio

Some times we have to use de division on template, django template language don't offer this feature, but we can "emulate" this behavior with the "widthratio" template tag, see:

[
{
"tema": "Desenvolvimento mobile por onde começar?",
"autor": "Nonilton",
"objetivo": ""
},
{
"tema" : "(RWD) Responsive Web Design: Por uma interface na medida",
"autor": "Emmanuel",
"objetivo": "O objetivo seria conscientizar os novos desenvolvedores da importância do desenvolvimento responsivo e tornar claro aos que pretendem iniciar na programação web que o RWD é um caminho sem volta."
>>> class XYZ(object):
... def __init__(self):
... print 'Output!'
...
>>> kls = 'XYZ'
>>> inst = locals()[kls]
>>> inst
<class '__main__.XYZ'>
>>> inst()
Output!
>>> class Classe(object):
... def __init__(self):
... print "Output!"
...
>>> var = Classe
>>> var
<class '__main__.Classe'>
>>> var()
Output!
>>>