Skip to content

Instantly share code, notes, and snippets.

@alfredo
alfredo / ctags.setup
Created November 27, 2015 10:31 — forked from nazgob/ctags.setup
ctags setup on mac
# you have ctags but it does not work...
$ ctags -R --exclude=.git --exclude=log *
ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
#you need to get new ctags, i recommend homebrew but anything will work
$ brew install ctags
#alias ctags if you used homebrew
$ alias ctags="`brew --prefix`/bin/ctags"

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.

Contribute

There’s more to come, and I’d love to hear what you think. Give me feedback on Twitter (@nicoleslaw) or by email (nicole@nicolefenton.com). We all benefit from sharing our ideas and creating standards. Onward.

#! /usr/bin/env python2
# Requires: PIL, colormath
#
# Improved algorithm now automatically crops the image and uses much
# better color matching
from PIL import Image, ImageChops
from colormath.color_conversions import convert_color
from colormath.color_objects import LabColor
from colormath.color_objects import sRGBColor as RGBColor
@alfredo
alfredo / gist:5d1fdfcc85f57b584fb4
Last active August 29, 2015 14:14
Join Q objects.
from operator import __or__
from django.db.models import Q
qs = reduce( __or__, [Q(status=Site.PROCESSING), Q(status=Site.PUBLISHED)])
@alfredo
alfredo / gist:5412650
Last active December 16, 2015 09:28
Give some advice to yourself
# On a terminal in OSX:
$ function you_should (){ yes "you should $*" | xargs say -v good news; }
# Then run:
$ you_should write some tests
# Bonus points: close the console after running:
$ yes "I will get you if you don\'t write some tests [[slnc ``$RANDOM + 10000``]]" | xargs say -v Whisper &
@alfredo
alfredo / gist:4251471
Created December 10, 2012 16:01
Fast tests running with the MD5 hasher (Use only in the test settings)
# Faster tests with the MD5hasher.
PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher']
@alfredo
alfredo / gist:4130489
Created November 22, 2012 10:38
Logger config
import logging
import logging.config
# Logging
LOG_CONFIG = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'standard': {
'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s',
@alfredo
alfredo / gist:3205967
Created July 30, 2012 10:02
Mock a Django Model
# Based on https://github.com/dcramer/mock-django
import mock
from django.utils.unittest import TestCase
from project.app.models import Category
class ModelMock(mock.MagicMock):
@alfredo
alfredo / gist:2929790
Created June 14, 2012 11:35
Add DEBUG log to django_browserid, when using mozilla playdoh
# Add this to your local settings file
# This will log DEBUG events for django_browserid
debug = dict(level=logging.DEBUG)
LOGGING = {
'loggers': {
'django_browserid': debug,
},
}
@alfredo
alfredo / gist:1962031
Created March 2, 2012 22:47
Running the remote driver with Selenium and python
1. Download the latest selenium standalone server from:
http://code.google.com/p/selenium/downloads/list
2. Install the python selenium webdriver:
$ pip install selenium
3. Run the selenium server: