Version: 2022.02.25a
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
worker_processes 10; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include /etc/nginx/mime.types; | |
gzip on; |
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
var gulp = require('gulp'); | |
var concat = require('gulp-concat'); | |
var sass = require('gulp-sass'); | |
var minifyCss = require('gulp-minify-css'); | |
var rename = require('gulp-rename'); | |
var gulpBowerFiles = require('gulp-bower-files'); | |
var paths = { | |
sass: ['./scss/**/*.scss'], | |
scripts: ['./app/**/*.js', './app/*.js'] |
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 base64 | |
from django.core.files.base import ContentFile | |
from rest_framework import serializers | |
class Base64ImageField(serializers.ImageField): | |
def from_native(self, data): | |
if isinstance(data, basestring) and data.startswith('data:image'): | |
# base64 encoded image - decode |
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 signals and slugify | |
from django.db.models import signals | |
from django.template.defaultfilters import slugify | |
# function for use in pre_save | |
def yourmodel_pre_save(signal, instance, sender, **kwargs): | |
if not instance.slug: | |
slug = slugify(instance.attribute) # change the attibute to the field that would be used as a slug | |
new_slug = 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
# coding: utf-8 | |
import unittest | |
# Unit tests for kata 'domevent' | |
''' Synchronous domain events in pure Python. | |
#- triggering an event | |
#- registering a callback | |
#- triggering an event with 1 handler | |
#- triggering an event with 2 handlers |