First, an exercise. Can we represent all of css with plain data? Let's try.
let redText = { color: 'red' };| from django.forms import ModelForm | |
| from django.template.loader import render_to_string | |
| from django.shortcuts import render | |
| from django.http import Http404 | |
| from django.contrib import messages | |
| class DynamicTableForm(ModelForm): | |
| """ | |
| Renders a table which can be optionally edited by a user using htmx. |
| // Should I be ES6+ing this file? Does it matter? Seems like it would feel nicer but running Babel over this file feels like ouroboros. | |
| // I'm using Gulp 3.x. I couldn't for the life of me get Gulp 4.x going, I think because my Gulp CLI was at too high (??) of a version and no amount of uninstalling and reinstalling would bring it back down. | |
| var gulp = require("gulp"); | |
| // I thought I needed this until I found out about gulp.series. Can I refactor anything here? | |
| var runSequence = require("run-sequence"); | |
| // Would this be a speed boost for anything? As in, only looking at files that have changed instead of all files? | |
| // https://github.com/sindresorhus/gulp-changed |
| function Mutilator(data, name, context) { | |
| this.n = name || `mutilation-${+new Date()}`; | |
| this.d = data; | |
| this.c = context || window; | |
| this.isArr = function(p) { | |
| return this.d[p].constructor == Array; | |
| }; | |
| this.dispatch = function(p, v, t) { | |
| this.c.dispatchEvent( | |
| new CustomEvent(this.n, { |
| const shortid = require("shortid"); // shortid.generate() returns a unique "short" id | |
| const txtgen = require("txtgen"); // txtgen.sentence() returns random "readable" sentences | |
| const faker = require("faker"); // faker is used for generating random fake data. | |
| const _ = require("lodash"); // lodash is a utility lib for Javascript | |
| const users = generateUsers(10); | |
| export const contacts = _.mapKeys(users, "user_id"); | |
| export const getMessages = messagesPerUser => { | |
| let messages = {}; | |
| _.forEach(users, user => { |
The following are examples of the four types rate limiters discussed in the accompanying blog post. In the examples below I've used pseudocode-like Ruby, so if you're unfamiliar with Ruby you should be able to easily translate this approach to other languages. Complete examples in Ruby are also provided later in this gist.
In most cases you'll want all these examples to be classes, but I've used simple functions here to keep the code samples brief.
This uses a basic token bucket algorithm and relies on the fact that Redis scripts execute atomically. No other operations can run between fetching the count and writing the new count.
TL;DR
Install Postgres 9.6, and then:
sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 mainhttps://realpython.com/blog/python/asynchronous-tasks-with-django-and-celery/
$ pip install celery
$ sudo apt-get install rabbitmq-server
Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.
You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.
TL;DR
9.4 -> 9.5:
sudo pg_dropcluster 9.5 main --stop
sudo service postgresql stop
sudo pg_upgradecluster -m upgrade -k 9.4 main
sudo su postgres -c "/usr/lib/postgresql/9.5/bin/vacuumdb --all --analyze-in-stages"
sudo pg_dropcluster 9.4 main