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 => { |
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 main
https://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
/* | |
A zero-indexed array A consisting of N integers is given. An equilibrium index of this array is any integer P such that 0 ≤ P < N and the sum of elements of lower indices is equal to the sum of elements of higher indices, i.e. | |
A[0] + A[1] + ... + A[P−1] = A[P+1] + ... + A[N−2] + A[N−1]. | |
Sum of zero elements is assumed to be equal to 0. This can happen if P = 0 or if P = N−1. | |
*/ | |
function solution(A) { | |
var sum = A.reduce(function(pv, cv) { return pv + cv; }); |