Skip to content

Instantly share code, notes, and snippets.

View Geekfish's full-sized avatar
🐝
... 🐝 ... 🐝 ... 🐝 ... 🐝

Eleni Lixourioti Geekfish

🐝
... 🐝 ... 🐝 ... 🐝 ... 🐝
View GitHub Profile
@Geekfish
Geekfish / README.md
Last active December 12, 2018 10:49
Ticket in commit msg (Github and CodebaseHQ versions)

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.

@Geekfish
Geekfish / comma_comma_and.py
Created August 20, 2018 14:09
Comma Comma And
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")
@Geekfish
Geekfish / useful_commands.md
Last active May 1, 2018 14:37
Useful commands

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
@Geekfish
Geekfish / tasks.py
Created October 31, 2017 15:20
Transaction Aware Celery Task - SQLAlchemy
# 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):
"""
@Geekfish
Geekfish / Contract Killer 3.md
Created July 12, 2017 15:54 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

Tiny Content Framework

About the project

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).

Contents

@Geekfish
Geekfish / translation_utils.py
Last active October 21, 2016 11:11
Django Lazy translation format
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)
@Geekfish
Geekfish / bookmarklets.js
Last active September 26, 2016 13:22
Trello Card bookmarklets
// 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();})()
@Geekfish
Geekfish / pre-commit.py
Last active September 21, 2016 13:53
Pre-commit hook with flake8 and auto-named migrations
#!/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)
@Geekfish
Geekfish / pycharm_scopes.md
Created April 21, 2016 10:50
PyCharm Scopes

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: