Skip to content

Instantly share code, notes, and snippets.

Avatar

Rafael Chagas rafaelchagasb

  • Brasília, DF
View GitHub Profile
@rafaelchagasb
rafaelchagasb / gist:ea167a5268b5691b3c8edad4d435547d
Last active Mar 12, 2018
Configuração do eslint no vscode
View gist:ea167a5268b5691b3c8edad4d435547d
npm init -y
npm i --save-dev eslint eslint-config-airbnb-base eslint-plugin-import
.eslintrc.js
Configure task vscode
{
// See http://go.microsoft.com/fwlink/?LinkId=733558
@rafaelchagasb
rafaelchagasb / README.md
Created Sep 10, 2016 — forked from vicainelli/README.md
10 livros que todo mundo deveria ler - by Murilo Gun
View README.md

10 livros que todo mundo deveria ler

by Murilo Gun

  1. Abundancia - O futuro é melhor do que você imagina | Steven Kotler e Peter H. Diamandis
  2. VLEF - Vai lá e faz
  3. A Startup Enxuta - Como Os Empreendedores Atuais Utilizam a Inovação
  4. Marketing e Comunicação da Era Pós-Digital - As Regras Mudaram | Walter Longo
  5. De Onde Vem as Boas Ideias | Steven Johnson
  6. Steve Jobs - A Biografia | Walter Isaacson
View gist:1967ccbf1ca0ff12093eceba172f51b3
import java.io.FileInputStream;
import java.security.MessageDigest;
public class Main {
public static void main(String[] args)throws Exception
{
MessageDigest md = MessageDigest.getInstance("SHA-512");
FileInputStream fis = new FileInputStream("/home/rafael/Downloads/ACcompactado.zip");
@rafaelchagasb
rafaelchagasb / gist:5551656
Created May 10, 2013
Consulta de strings sem o acento.
View gist:5551656
-- Consulta de strings sem o acento.
select * from nomeDaSuaTabela where sem_acento(colunaDaTabela) iLIKE sem_acento('SUA STRING')
-- Exemplo:
select * from municipio where sem_acento(nome) iLIKE sem_acento('SãO PAULO')
-- O trecho abaixo precisa ser executado somente uma vez no banco que você for usar a função.
@rafaelchagasb
rafaelchagasb / gist:3845490
Created Oct 6, 2012
Filtro de municípios por estados - Django 1.3
View gist:3845490
/* >>>>>>>>>>>>>>> models.py <<<<<<<<<<<<< */
from django.db import models
class MeuModelo(models.Model):
estado = models.ForeignKey('Estado')
cidade = models.ForeignKey('Cidade')
class Pais(models.Model):
@rafaelchagasb
rafaelchagasb / gist:3521814
Created Aug 30, 2012
Estrutura básica site
View gist:3521814
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<head>
<link rel="stylesheet" type="text/css" href="css/todos_estilos.css"/>
</head>
<body>
</body>
@rafaelchagasb
rafaelchagasb / player_video_youtube.html
Created Apr 17, 2012
Player de vídeo incorporado do Youtube
View player_video_youtube.html
<html>
<head>
<title>Inserindo vídeos do YouTube em uma página HTML</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>Meu vídeo preferido</p>
<object style="height: 390px; width: 640px">
<param name="movie" value="http://www.youtube.com/v/IUsV--AhxrM?version=3&feature=player_detailpage">
<param name="allowFullScreen" value="true">
View gist:1920478
def index(request):
MapImageFormSet = inlineformset_factory(MapData,Imagem)
if request.method == 'POST':
form = MapImageFormSet(request.POST,request.FILES)
if form.is_valid():
form.save()
mostrar = 'Salvo!'
form = MapImageFormSet()
else:
form = MapImageFormSet()
View gist:1920429
try:
import Image
except ImportError:
from PIL import Image
from django.contrib import admin
from django import forms
from map.models import MapData,Imagem
class ImagemInline(admin.StackedInline):
View gist:1920368
# -*- coding: utf8 -*-
from django.db import models
# SIGNALS
from django.db.models import signals
from utils.signals_comuns import slug_pre_save
from datetime import datetime
from django.db import models
from django.core.urlresolvers import reverse