Skip to content

Instantly share code, notes, and snippets.

View gonvaled's full-sized avatar
💭
Working as senior backend python develper, and accepting requests

Daniel G. gonvaled

💭
Working as senior backend python develper, and accepting requests
View GitHub Profile
[tool.poetry]
name = "poetry-demo"
version = "0.1.0"
description = ""
authors = ["gonvaled"]
[tool.poetry.dependencies]
python = "^3.6"
dj-database-url = "^0.5.0"
Django = "^2.0.7"
@gonvaled
gonvaled / forms.py
Last active June 26, 2021 14:48
Django widget to replace the file selection standard button by an image preview. Tested with Django 1.8.5
from django.forms import ModelForm, FileField
from .models import Campaign
from .widgets import ImagePreviewWidget
class DesignCampaignForm(ModelForm):
brand_logo = FileField(widget=ImagePreviewWidget)
@gonvaled
gonvaled / data.json
Last active December 27, 2015 22:29 — forked from ChrisJamesC/data.json
{"nodes":[
{"x":80, "r":40, "label":"Node 1"},
{"x":200, "r":60, "label":"Node 2"},
{"x":380, "r":80, "label":"Node 3"}
]}
@gonvaled
gonvaled / get_closure.py
Created October 5, 2013 11:59
Wrapper around Closure Compiler API
import httplib
import sys
import urllib
from contextlib import closing
################################################################################################################
# Compilation level
WHITESPACE_ONLY_CL = 'WHITESPACE_ONLY'
SIMPLE_OPTIMIZATIONS_CL = 'SIMPLE_OPTIMIZATIONS'
@gonvaled
gonvaled / gist:2429165
Created April 20, 2012 14:41
Setup elasticsearch index with two couchdb rivers
#!/bin/bash
server="localhost:9200"
index="my_index"
river1="first_river"
host1="localhost"
port1="5984"
db1="firstdb"
type1="firsttype"
@gonvaled
gonvaled / gist:1688268
Created January 27, 2012 10:56
Setup an Elastic Search index which will index only one field: "note_text"
server="localhost"
printf "\n\nCreate the index\n"
curl -XPUT "$server:9200/index1"
printf "\n\nCreate the mapping\n"
curl -XPUT "$server:9200/index1/mapping1/_mapping" -d '{
"type1" : {
"dynamic" : false,
"properties" : {