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, os.path | |
| import sys | |
| # Unless your project is already on your PYTHONPATH by default, you need to add it: | |
| # project_directory should point to your project's parent directory. | |
| project_directory = os.path.join(os.path.dirname(__file__), '..') | |
| if project_directory not in sys.path: | |
| sys.path.insert(0, project_directory) | |
| os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' |
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
| # -*- coding: utf-8 -*- | |
| from celery.task import task | |
| from imagekit.cachestate import PessimisticCacheStateBackend | |
| @task | |
| def generate(model, pk, attr): | |
| try: | |
| instance = model._default_manager.get(pk=pk) | |
| except model.DoesNotExist: |
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 models | |
| from imagekit.processors import * | |
| from imagekit.models.fields import ImageSpecField | |
| import os | |
| def get_thumb_processors(instance, file): | |
| return [resize.ResizeToFill(width=instance.thumb_width, | |
| height=instance.thumb_height)] |
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
| // 1. Relying on pluralization can be tricky. | |
| var payload = { | |
| "deer": { | |
| "id": 1, | |
| "name": "Bambi", | |
| "related_deer": [1, 2, 3] | |
| }, | |
| "deerses": [ // ???? | |
| {"id": 2, ...}, |
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 models | |
| from imagekit import ImageSpec | |
| from imagekit.models import ImageSpecField | |
| from imagekit.utils import get_field_info | |
| from imagekit import register | |
| import os | |
| class TvSpec(ImageSpec): | |
| suffix = '-tv' |
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
| // | |
| // Usage: | |
| // | |
| // @import 'remedy.less'; | |
| // @remedy-base-size: 16px; | |
| // .something { | |
| // .remedy('font-size'; 12px); | |
| // .remedy('margin'; 1.2rem 3rem); | |
| // } | |
| // |
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
| # A simple "once" implementation. Can be replaced with _.once or similar. | |
| once = (func) -> | |
| ran = false | |
| -> | |
| return if ran | |
| ran = true | |
| func.apply this, arguments | |
| func = null | |
| undefined |
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
| { | |
| "arrow_spacing": { | |
| "level": "error" | |
| }, | |
| "camel_case_classes": { | |
| "level": "error" | |
| }, | |
| "coffeescript_error": { | |
| "level": "error" | |
| }, |
OlderNewer