Skip to content

Instantly share code, notes, and snippets.

View brunobbbs's full-sized avatar

Bruno Barbosa brunobbbs

View GitHub Profile
@ibraheem4
ibraheem4 / postgres-brew.md
Last active May 20, 2024 07:49 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
import bleach
import json as jsonlib
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.filter
def json(value):
@rg3915
rg3915 / boilerplate2.sh
Last active February 17, 2023 11:53
Boilerplate: Shell script to create a complete Django project in Mac with Python 3.7 and Django 2.2.12
# Shell script to create a complete Django project.
# This script require Python 3.x and pyenv
# Settings.py is config to Django 2.2.12
# The project contains:
# Settings config
# Person model and form
# Person list and detail
# Person create, update and delete
# Admin config
// using jQuery
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
@chronossc
chronossc / find_store.py
Created October 12, 2015 21:37
Search neares store. Store must be a model with lat/lng fields.
from decimal import Decimal
from geopy.distance import great_circle # or distance
from seuapp.models import Store
# decimal places degrees distance
# --------------- ------- --------
# 0 1 111 km
# 1 0.1 11.1 km
# 2 0.01 1.11 km
# 3 0.001 111 m
@cauethenorio
cauethenorio / php-array-to-dict.py
Last active August 29, 2015 14:21
converter inputs de array (PHP) para um dict python
# coding: utf8
import re
from functools import reduce
def merge_dicts(*dicts):
# http://stackoverflow.com/questions/7204805/dictionaries-of-dictionaries-merge
if not reduce(lambda x, y: isinstance(y, dict) and x, dicts, True):
raise TypeError("Object in *dicts not of type dict")
@luzfcb
luzfcb / resposta_aos_novatos.md
Last active March 13, 2024 21:20
resposta aos iniciantes novatos pythonbrasil

Olá, seja bem vindo ao grupo Python-Brasil.

  • Insira aqui o pedido de mais informações ou possivel solução a pergunta feita

Dito isto, aqui nós possuímos algumas regras que ajudam a manter essa lista útil e agradável para os participantes

Antes de mandar as suas próximas perguntas, pedimos para que leia o texto:

@eliasdorneles
eliasdorneles / graph_coloring.py
Last active August 1, 2021 12:44
Basic implementation of graph coloring
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# INSTRUCTIONS:
#
# 1) Install graphviz (http://www.graphviz.org)
# 2) Run on terminal:
# python graph_coloring.py | dot -Tpng -o graph.png
# or, if you have imagemagick installed:
# python graph_coloring.py | dot -Tpng | display
@tracker1
tracker1 / 01-directory-structure.md
Last active May 4, 2024 19:55
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used