The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Original post
from jobs import send_welcome_email | |
# ... | |
def register_user(): | |
user = do_the_registration() | |
send_welcome_email.transaction_aware_delay(user.id) | |
# or | |
# send_welcome_email.request_aware_delay(user.id) | |
# Based on Django version found here: | |
# https://gist.github.com/tapanpandita/a84938354d32b0f12423d69259e06c2c | |
from celery import Task | |
from sqlalchemy import event | |
from some_module import DBSession | |
class TransactionAwareTask(Task): | |
""" |
This is a tiny content strategy framework focused on goals, messages, and branding. This is not a checklist. Use what you need and scrap the rest. Rewrite it or add to it. These topics should help you get to the bottom of things with clients and other people you work with.
Give me feedback on Twitter (@nicoleslaw) or by email ([email protected]).
from PyPDF2 import PdfFileReader, PdfFileWriter | |
from PyPDF2.pdf import PageObject | |
reader = PdfFileReader(open("invoice.pdf",'rb')) | |
invoice_page = reader.getPage(0) | |
sup_reader = PdfFileReader(open("supplement.pdf",'rb')) | |
sup_page = sup_reader.getPage(1) # We pick the second page here | |
translated_page = PageObject.createBlankPage(None, sup_page.mediaBox.getWidth(), sup_page.mediaBox.getHeight()) |
from django.utils.functional import allow_lazy | |
def _lazy_format(lazy_text, format_params): | |
return lazy_text % format_params | |
lazy_format = allow_lazy(_lazy_format, unicode) |
#!/usr/bin/env python | |
import sys, subprocess, collections | |
from flake8.hooks import git_hook, get_git_param | |
# `get_git_param` will retrieve configuration from your local git config and | |
# then fall back to using the environment variables that the hook has always | |
# supported. | |
# For example, to set the complexity, you'll need to do: | |
# git config flake8.complexity 10 | |
COMPLEXITY = get_git_param('FLAKE8_COMPLEXITY', 10) |
// Get Card's last URL segment (eg 4468-fix-the-login-page): | |
javascript:(function(s){try{s=document.selection.createRange().text}catch(_){s=document.getSelection()}prompt('', window.location.href.split("/").pop().split("#")[0])})() | |
// Get Card's full hash (eg 5731b92ef660293533517de9) : | |
javascript:(function(s){try{s=document.selection.createRange().text}catch(_){s=document.getSelection()}$('.js-more-menu').click(); prompt('', $('.js-export-json').attr('href').split("/")[2]); $('.js-more-menu').click();})() | |
// Get Card's unique id (board-independent, eg rKBmQeOk) : | |
javascript:(function(s){try{s=document.selection.createRange().text}catch(_){s=document.getSelection()}$('.js-more-menu').click(); prompt('', $('.js-short-url').attr('value').split("/").slice(-1)[0]); $('.js-more-menu').click();})() |
If you want to include/exclude directories from your search only (not the project), you can add a Custom Scope.
This can be found in Preferences -> Appearance & Behavior -> Scopes
.
For example, a scope that excludes migrations:
!file[*]:*/migrations/*
And the reverse scope that will only include migrations:
#!/bin/bash | |
############################################################################### | |
# | |
# ./hipchat_room_message | |
# | |
# A script for sending a system message to a room. | |
# | |
# Docs: http://github.com/hipchat/hipchat-cli | |
# |