Skip to content

Instantly share code, notes, and snippets.

View kryskool's full-sized avatar

Christophe CHAUVET kryskool

View GitHub Profile
@lucianoratamero
lucianoratamero / README.md
Last active November 10, 2024 23:54
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:

#!/usr/bin/env python
from sys import argv
if len(argv) != 2:
print('usage: %s filename.kv' % argv[0])
exit(1)
from kivy.lang import Builder
from kivy.app import App
@chanmix51
chanmix51 / deduplicate.sql
Created May 29, 2014 09:52
Remove duplicate rows from a table
with
dup_id as (select id, count(*) from school group by id having count(*) > 1),
del_dup as (delete from only school using dup_id where school.id = dup_id.id returning school.*)
insert into school select distinct on (id) del_dup.* from del_dup order by del_dup.id returning *;
@Ignas
Ignas / postgresql.mk
Created January 25, 2012 13:52
Set up for a local postgresql database using a Makefile
export PGPORT ?= 4488
PG_PATH ?= $(shell if test -d /usr/lib/postgresql/9.1; then echo /usr/lib/postgresql/9.1; else echo /usr/lib/postgresql/8.4; fi)
PG_DIR = ${PWD}/instance/var
PG_DATA = ${PG_DIR}/data
PG_RUN = ${PG_DIR}/run
PG_LOG = ${PG_DIR}/log
PG_SOCKET = ${PG_RUN}/.s.PGSQL.${PGPORT}
PGPARAMS = -D ${PG_DATA} -o "-F -c unix_socket_directory=${PG_RUN} -c custom_variable_classes='busy' -c busy.active_user=0" -l ${PG_LOG}/pg.log