Skip to content

Instantly share code, notes, and snippets.

View CleitonDeLima's full-sized avatar
🇧🇷
Working from home

Cleiton de Lima CleitonDeLima

🇧🇷
Working from home
View GitHub Profile
@lucianoratamero
lucianoratamero / README.md
Last active April 29, 2024 07:08
Using Vite with Django, the simple way

Using Vite with Django, the simple way

Warning

I'm surely not maintaining this as well as I could. There are also other possible, better integrated solutions, like django-vite, so keep in mind this was supposed to be more of a note to myself than anything :]

This gist has most of the things I've used to develop the frontend using vite inside a monolithic django app.

Here's a boilerplate that uses this approach: https://github.com/labcodes/django-react-boilerplate

A couple of things to note:

@douglasmiranda
douglasmiranda / django-media-permissions.md
Last active May 16, 2023 10:33
Fix Django Media Folder Permissions

Check your current file/directory permission with:

stat -c "%a" /path/to/dir_or_file

To recursively give directories read&execute privileges:

find /path/to/base/dir -type d -exec chmod 755 {} +
@sethbergman
sethbergman / install-docker.sh
Last active December 27, 2021 16:38 — forked from dweldon/install-docker.sh
Install Docker CE on Linux Mint 19
#!/usr/bin/env bash
set -e
# https://docs.docker.com/engine/install/ubuntu/
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - 2>/dev/null
sudo echo "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') bionic stable" > /etc/apt/sources.list.d/docker.list
sudo apt-get -y update
@genomics-geek
genomics-geek / README.md
Last active January 10, 2024 15:27
Setting up a Dockerized web application with Django REST APIs, ReactJS with Redux pattern, and Webpack Hot Reloading! Mouthful.

Guide on how to create and set up a Dockerized web app using Django REST APIs and ReactJS

Hopefully this will answer "How do I setup or start a Django project using REST Framework and ReactJS?"

This is a guide to show you step by step how this can be setup. If you just want to get started, use the cookiecuter I set up cookiecutter-django-reactjs. It basically is a fork of pydanny's cookiecutter, just added the front-end stuff :).

I created this because it was SUCH a pain in the ass setting up a project using all the latest technologies. After some research, I figured it out and have it working. The repo that implements this is located here. Feel free to use it as a boilerplate ;)

Main features:

  • Django REST APIs
@craigh411
craigh411 / select2-vuejs-component.md
Last active March 31, 2021 23:28
Vue.js component for Select2

#Vue.js component for Select2

A select2 component for vue.js. Quickly create select2 components, load data via ajax and retrieve selected values and newly created tags.

#Usage

Download and register the component:

Vue.component(
@webjunkie
webjunkie / forms.py
Last active February 4, 2023 22:12
JSONFieldFormMixin for Django ModelForm with JSON field
# the mixin
class JSONFieldFormMixin(object):
"""
Given that a model has some kind of TextField ``json_storage_field`` with
a string of JSON formatted data inside, this mixin adds handling of this
field to a ModelForm.
It will read the text field, convert to Python dict, fill the form fields
that are given via ``json_fields`` and on saving will write this back to
@gilyes
gilyes / Backup, restore postgres in docker container
Last active June 11, 2024 21:21
Backup/restore postgres in docker container
Backup:
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
Restore:
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres
@alexpatel
alexpatel / URLResolution_DjangoGSoC2015.md
Created April 3, 2015 16:12
Improved URL Resolution for Django - Proposal, Google Summer of Code 2015

Improved URL Resolution

Contents

  1. Abstract
  2. Current Infrastructure
  3. Motivation
  4. The URLResolver API
    1. Interface
  5. Usage
@guivan
guivan / tabela-cfop
Last active June 14, 2024 12:24
Lista de CFOP - Código Fiscal de Operação e Prestação CSV
1000;"ENTRADAS OU AQUISIÇÕES DE SERVIÇOS DO ESTADO"
1100;"COMPRAS PARA INDUSTRIALIZAÇÃO, COMERCIALIZAÇÃO OU PRESTAÇÃO DE SERVIÇOS"
1101;"Compra para industrialização ou produção rural"
1102;"Compra para comercialização"
1111;"Compra para industrialização de mercadoria recebida anteriormente em consignação industrial"
1113;"Compra para comercialização, de mercadoria recebida anteriormente em consignação mercantil"
1116;"Compra para industrialização ou produção rural originada de encomenda para recebimento futuro"
1117;"Compra para comercialização originada de encomenda para recebimento futuro"
1118;"Compra de mercadoria para comercialização pelo adquirente originário, entregue pelo vendedor remetente ao destinatário, em venda à ordem"
1120;"Compra para industrialização, em venda à ordem, já recebida do vendedor remetente"
@simonewebdesign
simonewebdesign / install_sublime_text.sh
Last active March 11, 2024 12:23
Install Sublime Text 3 on Linux via POSIX shell script - http://simonewebdesign.it/install-sublime-text-3-on-linux/
#!/bin/sh
# Sublime Text 3 Install (last update: Monday 13 March 2017)
#
# No need to download this script, just run it on your terminal:
#
# curl -L git.io/sublimetext | sh
# Detect the architecture