Skip to content

Instantly share code, notes, and snippets.


José Aguirre josejaguirre

Block or report user

Report or block josejaguirre

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
althonos / setup.cfg
Last active May 28, 2020
A `setup.cfg` template for my Python projects
View setup.cfg
name = {name}
version = file: {name}/_version.txt
author = Martin Larralde
author-email =
home-page ={name}
description = {description}
long-description = file:
rluts /
Last active May 24, 2020
Token authorization middleware for Django Channels 2
from channels.auth import AuthMiddlewareStack
from rest_framework.authtoken.models import Token
from django.contrib.auth.models import AnonymousUser
from django.db import close_old_connections
class TokenAuthMiddleware:
Token authorization middleware for Django Channels 2

Font Face

A mixin for writing @font-face rules in SASS.


Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);
n1ru4l / index.js
Created Aug 7, 2017
Fetch blob and convert to base64
View index.js
export const fetchAsBlob = url => fetch(url)
.then(response => response.blob());
export const convertBlobToBase64 = blob => new Promise((resolve, reject) => {
const reader = new FileReader;
reader.onerror = reject;
reader.onload = () => {
codephillip /
Created Aug 2, 2017
ListCreateAPIView in django rest framework with different serializer for the GET and POST
from rest_framework import generics, status
from rest_framework.response import Response
from rack.models import RackItem
from rack.serializers import RackItemSerializer, NewRackItemSerializer
class ListCreateRackItem(generics.ListCreateAPIView):
model = RackItem
davidwhitman / Preferences.kt
Last active May 31, 2020
Android SharedPreferences helper class for Kotlin. Easy-to-use delegated properties, automatic database creation, and listening for property changes.
View Preferences.kt
import android.content.Context
import android.content.SharedPreferences
import kotlin.reflect.KProperty
* Represents a single [SharedPreferences] file.
* Usage:
* ```kotlin
acdlite / app.js
Last active Apr 19, 2020
Quick and dirty code splitting with React Router v4
View app.js
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
ivanlmj /
Last active May 29, 2020
Demonstration of logging feature for a Flask App.
""" Demonstration of logging feature for a Flask App. """
from logging.handlers import RotatingFileHandler
from flask import Flask, request, jsonify
from time import strftime
__author__ = "@ivanleoncz"
import logging
hfalucas / [1] main.js
Last active May 25, 2020
[Vue.js] Authentication and Authorization
View [1] main.js
* Think of this "main.js" file as your application bootstrap.
import Vue from 'vue'
import Resource from 'vue-resource'
import VueRouter from 'vue-router'
import routes from './routes'
import middleware from './middleware'
Cjones90 /
Last active Apr 15, 2019
A javascript wrapper for the RealmDB node module used in React Native.

My RealmWrapper.js file. Uses RealmSchema.js for the schema.

You can find the "realmSchema.js" here and examples here

'use strict';

import Realm from 'realm';
import Schemas from "./realmSchemas.js";
const version = 51;
You can’t perform that action at this time.