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 Feb 1, 2020
A `setup.cfg` template for my Python projects
View setup.cfg
# https://gist.github.com/althonos/6914b896789d3f2078d1e6237642c35c
[metadata]
name = {name}
version = {version}
author = Martin Larralde
author-email = martin.larralde@ens-paris-saclay.fr
home-page = https://github.com/althonos/{name}
description = {description}
long-description = file: README.rst, CHANGELOG.rst
@rluts
rluts / token_auth.py
Last active Feb 13, 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);
@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 Jan 26, 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 Feb 11, 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 Nov 7, 2019
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 Feb 8, 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;
@devynspencer
devynspencer / ansible-github.yml
Last active Feb 12, 2020
Example playbook for cloning a private git repository with Ansible.
View ansible-github.yml
---
hosts: all
tasks:
- name: add github ssh key
copy: >
src=files/id_rsa.github
dest=/root/.ssh/id_rsa.github
owner=root
group=root
You can’t perform that action at this time.