Requires virtualenv and virtualenvwrapper.
cdco # cd to buildout root cds voxin # (will autocomplete with tab and will cd into the project named voxin in the src dir) buildout # will run buildout, but from the buildout root.
| # this file is in a package named verboten | |
| from django.utils.translation import ugettext_lazy as _ | |
| from django.http import HttpResponseForbidden | |
| from django.template import RequestContext, loader | |
| from django.db import models | |
| from django.conf import settings | |
| class LanguagePermissions(models.Model): | |
| """Only used to define permissions""" |
| import os | |
| from django.conf import settings | |
| from django.contrib.staticfiles.finders import BaseFinder, AppDirectoriesFinder | |
| from django.contrib.staticfiles.storage import AppStaticStorage | |
| from django.core.files.storage import FileSystemStorage | |
| from django.utils._os import safe_join | |
| class AppMediaStorage(AppStaticStorage): |
| from django import template | |
| register = template.Library() | |
| @register.simple_tag | |
| def props(obj): | |
| result = [] | |
| for key in dir(obj): | |
| try: | |
| result.append("%s -> %s<br/>" % (key, getattr(obj, key))) | |
| except Exception as e: |
| #! /bin/sh | |
| cd /usr/share/locales | |
| ./install-language-pack eo | |
| ./install-language-pack ia | |
| ./install-language-pack ie | |
| ./install-language-pack io | |
| ./install-language-pack vo | |
| ./install-language-pack ca |
| from copy import deepcopy | |
| from google.appengine.ext import db | |
| import settings | |
| class I18nModelMetaClass(db.PropertiedClass): | |
| """ | |
| Metaclass for adding language specific attributes to a |
| AuthorizationRef authorizationRef; | |
| OSStatus status; | |
| status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, | |
| kAuthorizationFlagDefaults, &authorizationRef); | |
| // suppose we've got the new hosts file in an NSString called new_hosts_file | |
| NSString *overwrite_hosts = [NSString stringWithFormat:@"echo %s > /private/etc/hosts", new_hosts_file]; | |
| char *args[] = {[overwrite_hosts cstring]}; | |
| status = AuthorizationExecuteWithPrivileges(authorizationRef, "/bin/sh", | |
| kAuthorizationFlagDefaults, args, NULL); |
| > var one = 1; | |
| > var two = new one; | |
| > two; | |
| 1 | |
| > one = 2; | |
| > two; | |
| 1 | |
| > one; | |
| 2 |
| > var next = function(input) { | |
| > return input + 1; | |
| > } | |
| > var three = new next; | |
| > three; | |
| [Function] | |
| > three(2); | |
| 3 |
| > var three = new next(2); | |
| > three; | |
| 3 |