This Gist: http://is.gd/dokkudjango
DigitalOcean: https://www.digitalocean.com/
Dokku: https://github.com/progrium/dokku
Dokku-Postgres: https://github.com/Kloadut/dokku-pg-plugin
from datetime import datetime | |
from sqlalchemy import Column, Integer, DateTime, ForeignKey | |
from sqlalchemy.orm import relationship | |
from sqlalchemy.ext.declarative import declared_attr | |
from flask_security import current_user | |
class AuditMixin(object): | |
created_at = Column(DateTime, default=datetime.now) | |
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now) |
from django.contrib.admin import ModelAdmin | |
from .paginator import LargeTablePaginator | |
class MyTableAdmin(ModelAdmin): | |
... | |
paginator = LargeTablePaginator | |
show_full_result_count = False # Recommended to avoid another count() | |
... |
This Gist: http://is.gd/dokkudjango
DigitalOcean: https://www.digitalocean.com/
Dokku: https://github.com/progrium/dokku
Dokku-Postgres: https://github.com/Kloadut/dokku-pg-plugin
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
Beautiful is better than ugly. Explicit is better than implicit.
I frequently deal with collections of things in the programs I write. Collections of droids, jedis, planets, lightsabers, starfighters, etc. When programming in Python, these collections of things are usually represented as lists, sets and dictionaries. Oftentimes, what I want to do with collections is to transform them in various ways. Comprehensions is a powerful syntax for doing just that. I use them extensively, and it's one of the things that keep me coming back to Python. Let me show you a few examples of the incredible usefulness of comprehensions.
All of the tasks presented in the examples can be accomplished with the extensive standard library available in Python. These solutions would arguably be more terse and efficient in some cases. I don't have anything against the standard library. To me there is a certain
An engineering manager that I have the privilege of working with just asked me for three expectations of a principal engineer for a project that he is working on to mentor senior engineers at Twilio. Here is the list that I came up with.
# -*- coding: utf-8 -*- | |
""" | |
author: Trish Gillett (discardthree@gmail.com, @discardthree on github) | |
Basic scraper to check the Packt Publishing Free ebook of the day. | |
This version uses selenium because when I tried getting the source via the | |
requests package it sometimes seemed to return the source for a version of | |
the website that was different from the one that was live. | |
Adapted from this code which was used by Estela Alvarez (supita@gmail.com) | |
to demo webscraping at a Montreal Pyladies meeting: |
By the way, I'm available for tutoring and code review :)
new Promise
?.then
callback yet?](https://gist.github.com/joepie91/4c3a10629a4263a522e3bc4839a28c83#6-but