This is a hook that adds the ticket number to the commit message, if it can be infered by the branch name.
(ex. branch name bugfix/5234-fix-a-thing
would result in #5234
for the github version or [t: 5234]
for the codebase version.
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
def comma_comma_and(_list, conj=u"and"): | |
""" | |
Accepts a list of strings and returns a single string, stitching it all | |
together. | |
Eg: | |
comma_comma_and(["Papa Bear", "Mama Bear", "Baby Bear"]) | |
# > "Papa Bear, Mama Bear, and Baby Bear" | |
comma_comma_and(["Chocolate", "cake", "ice-cream"], conj="or") |
Show the SQL executed by a migration:
python manage.py sqlmigrate <appname> <migration no eg. 0001 or 0004>
Generate a signing key:
import random, string
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
# 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): | |
""" |
The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Original post
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 (nicole@nicolefenton.com).
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
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) |
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
// 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();})() |
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
#!/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) |
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: