This file contains hidden or 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
| // | |
| // ZbarPlug.h | |
| // Phun | |
| // | |
| // Created by Jeff Lee on 12/12/10. | |
| // Copyright 2010 __MyCompanyName__. All rights reserved. | |
| // | |
| #import <Foundation/Foundation.h> | |
| #import <UIKit/UIKit.h> |
This file contains hidden or 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 fabric.api import * | |
| """ | |
| Base configuration | |
| """ | |
| env.project_name = '$(project)' | |
| env.database_password = '$(db_password)' | |
| env.site_media_prefix = "site_media" | |
| env.admin_media_prefix = "admin_media" | |
| env.newsapps_media_prefix = "na_media" |
This file contains hidden or 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
| class QuerySetDoubleIteration(Exception): | |
| "A QuerySet was iterated over twice, you probably want to list() it." | |
| pass | |
| # "Skinny" here means we use iterator by default, rather than | |
| # ballooning in memory. | |
| class SkinnyManager(Manager): | |
| def get_query_set(self): | |
| return SkinnyQuerySet(self.model, using=self._db) |
This file contains hidden or 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 attach_foreignkey(objects, field, select_related=None): | |
| """ | |
| Shortcut method which handles a pythonic LEFT OUTER JOIN. | |
| ``attach_foreignkey(posts, Post.thread)`` | |
| """ | |
| field = field.field | |
| qs = field.rel.to.objects.filter(pk__in=distinct(getattr(o, field.column) for o in objects)) | |
| if select_related: | |
| qs = qs.select_related(*select_related) |
This file contains hidden or 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
| * { | |
| -webkit-touch-callout:none; /* prevent callout to copy image, etc when tap to hold */ | |
| -webkit-text-size-adjust:none; /* prevent webkit from resizing text to fit */ | |
| -webkit-tap-highlight-color:rgba(0,0,0,0); /* prevent tap highlight color / shadow */ | |
| -webkit-user-select:none; /* prevent copy paste, to allow, change 'none' to 'text' */ | |
| } |
This file contains hidden or 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
| {% load cms_tags sekizai_tags %} | |
| <!doctype html> | |
| <head> | |
| <title>{{ request.current_page.get_title }}</title> | |
| {% render_block "css" %} | |
| </head> | |
| <body> | |
| {% cms_toolbar %} | |
| {% placeholder "main" %} |
This file contains hidden or 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
| import os | |
| import re | |
| from django.template.loader import get_template | |
| from django.template.loaders.app_directories import app_template_dirs | |
| from django.core.exceptions import ImproperlyConfigured | |
| from django.utils.importlib import import_module | |
| from cms.models import Placeholder, Page |
This file contains hidden or 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 decimal import Decimal | |
| def roundTo5(value): | |
| ''' | |
| Rounds to the nearest 5 swiss franc cents and appends zeros to get a pretty value back. | |
| ''' | |
| return (Decimal(str(round(Decimal(str(value))*Decimal("20"))))/Decimal("20")).quantize(Decimal('1.00')) |
This file contains hidden or 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.db import connection | |
| from django.conf import settings | |
| cursor = connection.cursor() | |
| cursor.execute('SHOW TABLES') | |
| results=[] | |
| for row in cursor.fetchall(): | |
| results.append(row) | |
| for row in results: | |
| cursor.execute('ALTER TABLE %s CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;' % (row[0])) |
This file contains hidden or 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
| # assume the following directory structure where contents of doc/ | |
| # and source/ are already checked into repo., with the exception | |
| # of the _build directory (i,e. you can check in _themes or _sources | |
| # or whatever else). | |
| # | |
| # proj/ | |
| # source/ | |
| # doc/ | |
| # remove doc/_build/html if present |
OlderNewer