This article describes how to record audio using the Web Audio API in JavaScript. The related resources are shown below.
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
# coding: utf-8 | |
from django.core.exceptions import ValidationError | |
from django.core.files.images import get_image_dimensions | |
from django.utils.translation import ugettext_lazy as _ | |
from django.utils.deconstruct import deconstructible | |
@deconstructible | |
class ImageDimensionsValidator: |
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 random | |
import string | |
from django.utils.text import slugify | |
def random_string_generator(size=10, chars=string.ascii_lowercase + string.digits): | |
return ''.join(random.choice(chars) for _ in range(size)) | |
def unique_slug_generator(instance, new_slug=None): | |
if new_slug is not None: | |
slug = new_slug |
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
''' Useage '''' | |
# Declare our item | |
store = Store.objects.get(pk=pk) | |
# Define our models | |
stores = Store.objects.all() | |
# Ask for the next item | |
new_store = get_next_or_prev(stores, store, 'next') | |
# If there is a next item | |
if new_store: | |
# Replace our item with the next one |
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.contrib import admin | |
from example.models import Example | |
class ExampleAdmin(admin.ModelAdmin): | |
""" | |
Don't allow addition of more than one model instance in Django admin | |
See: http://stackoverflow.com/a/12469482 | |
""" | |
def has_add_permission(self, request): |
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 __future__ import absolute_import, unicode_literals | |
import os | |
from celery import Celery | |
from django.conf import settings | |
from robot.config import ROBOT_CELERY_BEAT_SCHEDULE | |
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'test.settings') |
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
/* Useful celery config. | |
app = Celery('tasks', | |
broker='redis://localhost:6379', | |
backend='redis://localhost:6379') | |
app.conf.update( | |
CELERY_TASK_RESULT_EXPIRES=3600, | |
CELERY_QUEUES=( | |
Queue('default', routing_key='tasks.#'), |
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
/* | |
* Only useful in changelist pages when the ModelAdmin displayed has | |
* "list_editable" (https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_editable) | |
* configured. | |
* | |
* When one of the input/select/textarea value is changed, automatically submit | |
* the form using ajax. | |
* | |
* Only form fields relevant to the "list_editable" will trigger a form submit. | |
* |
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
#!/usr/bin/env python | |
"""Download a file from ftp server.""" | |
import argparse | |
import logging | |
import os | |
from ftplib import FTP_TLS |