This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from "react"; | |
import PropTypes from "prop-types"; | |
import Helmet from "react-helmet"; | |
class PreviewPage extends Component { | |
constructor() { | |
super(); | |
this.state = { | |
post: { | |
title: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
import time | |
import requests | |
class ReadableAPIClient: | |
""" | |
API Client for Readable.io, written for Python 3 | |
See API documentation: https://readable.io/api/docs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django import forms | |
from django.contrib import admin | |
from django.utils.translation import ugettext as _ | |
from django.contrib.auth.admin import UserAdmin | |
from django.contrib.auth.forms import ReadOnlyPasswordHashField | |
from .models import User | |
class UserCreationForm(forms.ModelForm): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.utils.translation import ugettext_lazy as _ | |
from model_utils.fields import AutoCreatedField, AutoLastModifiedField | |
class IndexedTimeStampedModel(models.Model): | |
created = AutoCreatedField(_('created'), db_index=True) | |
modified = AutoLastModifiedField(_('modified'), db_index=True) | |
class Meta: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
from sys import argv | |
import requests | |
def transform_user_file(filename: str) -> []: | |
user_file = open(filename, 'r') | |
user_data = csv.reader(user_file) | |
# skip first row |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StudenAdmin(admin.ModelAdmin): | |
inlines = (StudentRecordInline,) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OrganizationImportExportResource(ModelResource): | |
types = widgets.ManyToManyWidget(model=graph_models.OrganizationType, | |
field='name') | |
class Meta: | |
model = Organization | |
fields = [ | |
'name', | |
] | |
import_id_fields = ['name'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Initialize pathogen for flake8 | |
execute pathogen#infect() | |
syntax on | |
filetype plugin indent on | |
" remove trailing spaces in Python & Markdown | |
autocmd BufWritePre *.py :%s/\s\+$//e | |
autocmd BufWritePre *.md :%s/\s\+$//e | |
" call flake8 at every save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from model_mommy import generators | |
MOMMY_CUSTOM_FIELDS_GEN = { | |
'easy_thumbnails.fields.ThumbnailerImageField': generators.gen_image_field, | |
'model_utils.fields.AutoCreatedField': generators.gen_datetime, | |
'model_utils.fields.AutoLastModifiedField': generators.gen_datetime, | |
'django_extensions.db.fields.AutoSlugField': generators.gen_slug, | |
} |
NewerOlder