Skip to content

Instantly share code, notes, and snippets.

View yoandresaav's full-sized avatar
🏠
Working from home

Yoandre Saavedra Gonzalez yoandresaav

🏠
Working from home
View GitHub Profile
@yoandresaav
yoandresaav / Operaciones-Git
Created August 4, 2017 17:18 — forked from jelcaf/Operaciones-Git
Git Tips - Mini-trucos de Git para facilitarme la tarea
#############################################
# Push de la rama actual
git push origin $rama_actual
#############################################
# Volver a un commit anterior, descartando los cambios
git reset --HARD $SHA1
#############################################
# Ver y descargar Ramas remotas
@yoandresaav
yoandresaav / DjangoAjax.js
Created October 26, 2017 15:59 — forked from gaspardzul/DjangoAjax.js
Este Gist te permite configurar las peticiones AJAX que haces en proyectos Django utilizando Jquery.
/**
* Este script de javascript permite trabajar transparentemente solicitudes que requieren
* protección del token CSRF por medio de AJAX JQUERY.
* Esto te permitirá hacer solcitudes a web Services de Django por medio de AJAX Jquery.
* Para utilizarlo basta con integrar el archivo DjangoAjax.js en tu directorio de JS y hacer referencia a él en tus templates
* que requieren del uso de AJAX por POST o algún otro que requiera el token CSRF.
* Este script está basado en la documentación oficial de Django https://docs.djangoproject.com
*/
$(function(){
@yoandresaav
yoandresaav / auth_views.py
Created December 21, 2017 20:53 — forked from stefanfoulis/auth_views.py
django: class based authentication view (login)
#-*- coding: utf-8 -*-
import urlparse
from django.contrib.auth import REDIRECT_FIELD_NAME, login
from django.contrib.auth.forms import AuthenticationForm
from django.http import HttpResponseRedirect
from django.utils.decorators import method_decorator
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_protect
from django.views.generic.edit import FormView
from django.conf import settings

Build a scalable Twitter clone with Django and GetStream.io

In this tutorial we are going to build a Twitter clone using Django and GetStream.io, a hosted API for newsfeed development. We will show you how easy is to power your newsfeeds with GetStream.io. At the end of this tutorial we will have a Django app with a profile feed, a timeline feed, support for following users, hashtags and mentions.

I assume that you are familiar with Django. If you're new to Django the [official tutorial] (https://docs.Djangoproject.com/en/1.7/intro/install/) explains it very well.

Bootstrap the Django application

.reset-this {
animation : none;
animation-delay : 0;
animation-direction : normal;
animation-duration : 0;
animation-fill-mode : none;
animation-iteration-count : 1;
animation-name : none;
animation-play-state : running;
animation-timing-function : ease;
countries = markets.get('Countries')
objs = [
SkyMarkets(
code=market['Code'],
name=market['Name']
)
for market in countries
]
SkyMarkets.objects.bulk_create(objs)
const csrfmiddlewaretoken = $("[name=csrfmiddlewaretoken]").val();
- Ngrok: crea un túnel ssh a tu localhost. sirve para probar apis externas que necesiten https.
- Poedit: crear y editar idiomas para django.
- Imnsonia: cliente rest similar al postman.
- pgAdmin: cliente postgrees.
- Kite: ia para programar, docs etc. https://kite.com/download/
@yoandresaav
yoandresaav / gist:3e70a8b1ae1f4e3e475490dea84766b8
Created November 27, 2019 18:11
Mantiene el evento click siempre anclado aunque se relllene el html del div
$("body").delegate(".link_name", 'click', function(e){
// function body
})
class ContactForm(forms.Form):
def __ini__(etc):
super(etc)
self.label_suffix = '?'