Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
| """ | |
| jQuery templates use constructs like: | |
| {{if condition}} print something{{/if}} | |
| This, of course, completely screws up Django templates, | |
| because Django thinks {{ and }} mean something. | |
| Wrap {% verbatim %} and {% endverbatim %} around those | |
| blocks of jQuery templates and this will try its best |
| javascript: (function () { | |
| function c() { | |
| var e = document.createElement("link"); | |
| e.setAttribute("type", "text/css"); | |
| e.setAttribute("rel", "stylesheet"); | |
| e.setAttribute("href", f); | |
| e.setAttribute("class", l); | |
| document.body.appendChild(e) | |
| } | |
| function h() { |
| #! /usr/bin/env python | |
| #coding:utf-8 | |
| import sys | |
| import os | |
| from random import randint, random | |
| sys.path.insert(0, os.path.expanduser('PATH_OF_YOUR_DJANGO_PROJECT')) | |
| os.environ['DJANGO_SETTINGS_MODULE'] = 'settings.py' |
| Ejecutar en terminal | |
| ssh-keygen -t rsa -C "[email protected]" | |
| luego copiar la llave publica ubicada en ~/.ssh/id_rsa.pub en el tab ssh keygens en la configuracion de la cuenta de github |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
Install Homebrew
Install a few things with homebrew:
Notice that some packages give you information at the end, read it carefully. To recall that info use brew info like this: $ brew info postgresql
$ brew install python --universal
| import json | |
| from django.contrib.auth.decorators import login_required | |
| from django.http import HttpResponse | |
| from django.utils.decorators import method_decorator | |
| class LoginRequiredMixin(object): | |
| @method_decorator(login_required) | |
| def dispatch(self, request, *args, **kwargs): |
| from myapp.views import error_handler | |
| handler404 = error_handler.error404 | |
| from django.http import HttpResponseNotFound | |
| def error404(request): | |
| t = loader.get_template('404.html') | |
| html = t.render(Context()) | |
| return HttpResponseNotFound(html) |
| for (property in location) { | |
| if (typeof location[property] !== 'object') { | |
| console.log(property); | |
| } | |
| } |
| @task(name='create_thumbnail') | |
| def create_thumbnail(product_photo): | |
| size = settings.PHOTO_THUMBNAIL_SIZE | |
| original_name = product_photo.original.name | |
| extension = original_name.split('.')[-1] | |
| if extension.lower() == 'jpg': | |
| extension = 'jpeg' | |
| name = original_name.split('.')[-2] | |
| image = Image.open(product_photo.original.path) | |
| image = ImageOps.fit(image, size, Image.ANTIALIAS) |