Skip to content

Instantly share code, notes, and snippets.

View Brunux's full-sized avatar
💭
I'm the 🐼 ... to the right

Bruno Fosados Brunux

💭
I'm the 🐼 ... to the right
View GitHub Profile
@Brunux
Brunux / views.py
Created June 20, 2020 21:51
WebRTC Streaming example
class StreamingView(TemplateView):
"""
"""
template_name = 'experiments/streaming.html'
class StreamingOfferView(CsrfExemptMixin, View):
"""
"""
@classonlymethod
@Brunux
Brunux / urls.py
Created June 16, 2020 04:53
async url
from django.urls import path
from . import views
urlpatterns = [
path('offer', views.OfferView.as_view(), name='offer'),
]
@Brunux
Brunux / asgi.py
Created June 16, 2020 04:28
async app configuration
"""
ASGI config for djinar project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/asgi/
"""
import os
@Brunux
Brunux / views.py
Last active June 16, 2020 04:39
Async post view
import asyncio
from django.http.response import HttpResponse
from django.utils.decorators import classonlymethod
from django.views.generic import View
class OfferView(View):
"""Base Async View."""
@Brunux
Brunux / views.py
Last active June 16, 2020 04:39
django async cbv
import asyncio
from django.utils.decorators import classonlymethod
from django.views.generic import View
class OfferView(View):
"""Base Async View."""
@classonlymethod
@Brunux
Brunux / GitCommitEmoji.md
Created March 5, 2020 19:18 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
"""
Django ORM Optimization Tips
Caveats:
* Only use optimizations that obfuscate the code if you need to.
* Not all of these tips are hard and fast rules.
* Use your judgement to determine what improvements are appropriate for your code.
"""
# ---------------------------------------------------------------------------
@Brunux
Brunux / contacts.html
Created January 22, 2020 20:17
Vuejs and Django app
{% load static %}
<!DOCTYPE html>
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
</head>
<body>
@Brunux
Brunux / views.py
Created January 22, 2020 20:14
Contacts Django View
from django.views.generic import TemplateView
from rest_framework import filters
from rest_framework.generics import (
ListAPIView,
CreateAPIView,
RetrieveUpdateDestroyAPIView
)
from .models import Contact
from .serializers import ContactSerializer, ContactCreateSerializer
@Brunux
Brunux / NavBar.vue
Created December 12, 2019 22:31
Rescaty NavBar
<template>
<b-navbar shadow fixed-top>
<template slot="brand">
<b-navbar-item tag="router-link" :to="{ path: '/' }">
<img
src="../assets/logo_transparent_simple.png"
alt="Lightweight UI components for Vue.js based on Bulma"
>
<b-icon
icon="dog"