View listo_pollo.sh
alias big="toilet -f bigmono12 -F gay" | |
color_screen () { | |
# Expects code like 1;30;42m | |
cols=$(tput cols) | |
lines=$(tput lines) | |
str="\033[$1" | |
i=0 |
View merge_model_objects.py
# Based on https://djangosnippets.org/snippets/2283/ | |
from django.db import transaction | |
from django.db.models import get_models, Model | |
from django.contrib.contenttypes.generic import GenericForeignKey | |
@transaction.atomic | |
def merge_model_objects(primary_object, alias_objects=None, keep_old=False): | |
""" | |
Use this function to merge model objects (i.e. Users, Organizations, Polls, |
View co.nickmerrill.cursors.app-demo-disc.cape
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Author</key> | |
<string>Nick Merrill</string> | |
<key>CapeName</key> | |
<string>App Demo Disc</string> | |
<key>CapeVersion</key> | |
<real>1</real> |
View ExceptionUserInfoMiddleware.py
class ExceptionUserInfoMiddleware(object): | |
def process_exception(self, request, exception): | |
try: | |
user = request.user | |
if user.is_authenticated(): | |
request.META['USER_ID'] = str(user.id) | |
request.META['USER_NAME'] = str("%s %s" % (user.first_name, user.last_name)) | |
request.META['USER_EMAIL'] = str(user.email) | |
except: | |
pass |
View aliases
# Usage: | |
# download-site https://django-tastypie.readthedocs.org/en/latest/ | |
alias download-site="wget --recursive --page-requisites --html-extension --convert-links --no-parent" |
View SelectiveSubviews.m
/* | |
Example use: | |
// Return all labels of the cell | |
NSMutableArray *labels = [Utility ApplyToSubviews:cell limitedToClass:[UILabel class] usingBlock:^(id obj) { | |
UILabel *label = (UILabel *)obj; | |
label.text = @"Changed text"; | |
} recursively:YES]; | |
*/ |