Skip to content

Instantly share code, notes, and snippets.

🤺
Programming

José Aguirre josejaguirre

🤺
Programming
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
althonos / setup.cfg
Last active May 28, 2020
A `setup.cfg` template for my Python projects
View setup.cfg
# https://gist.github.com/althonos/6914b896789d3f2078d1e6237642c35c
[metadata]
name = {name}
version = file: {name}/_version.txt
author = Martin Larralde
author-email = martin.larralde@embl.de
home-page = https://github.com/althonos/{name}
description = {description}
long-description = file: README.md
@rluts
rluts / token_auth.py
Last active May 24, 2020
Token authorization middleware for Django Channels 2
View token_auth.py
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
"""
View README.md

Font Face

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

Usage

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

@include font-face(Samplino, fonts/Samplino);
@n1ru4l
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 = () => {
resolve(reader.result);
};
reader.readAsDataURL(blob);
@codephillip
codephillip / CustomListCreateApi.py
Created Aug 2, 2017
ListCreateAPIView in django rest framework with different serializer for the GET and POST
View CustomListCreateApi.py
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
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
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
ivanlmj / flask_app_logging.py
Last active May 29, 2020
Demonstration of logging feature for a Flask App.
View flask_app_logging.py
#/usr/bin/python3
""" 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
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
Cjones90 / RealmWrapper.md
Last active Apr 15, 2019
A javascript wrapper for the RealmDB node module used in React Native.
View RealmWrapper.md

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.