We like suit. You should too.

Discoholic 🪩

⁂
wallacepolsom
$LAYYYTER
i don't do bad sauce passes

祝日 / Permanent Vacation
Aqua Utopia|海の底で記憶を紡ぐ
we're not kids anymore.
Sade Olutola
Show & Tell

tannertan36
KIROKAZE

PR's Tumblrdome
h
Cosmic Funnies
No title available
Three Goblin Art
Alisa U Zemlji Chuda

izzy's playlists!
YOU ARE THE REASON
seen from United States
seen from United States

seen from United States
seen from Argentina

seen from Türkiye

seen from United States
seen from Malaysia

seen from Malaysia

seen from United States
seen from United States
seen from Germany

seen from United States
seen from United States

seen from Russia

seen from Malaysia

seen from Serbia
seen from United States
seen from United States
seen from United States
seen from United States
@failnotes-blog
We like suit. You should too.
NSTimer and NSRunLoop
When working with NSTimers that should update certain stuff in the UI, don't forget to add your timer to the corresponding NSRunLoop mode:
NSRunLoop *runloop = [NSRunLoop currentRunLoop]; [runloop addTimer:self.frameTimer forMode:NSRunLoopCommonModes]; [runloop addTimer:self.frameTimer forMode:UITrackingRunLoopMode];
Otherwise your timer won't fire while the user interacts with your controls.
xScope
When implementing pixel perfect designs, you should use [xScope](http://iconfactory.com/software/xscope). Don't whine about the price. Grow up. It's worth it.
Documentation
If you find yourself googling django, python, javascript and other language documentation all the time, you might find [Dash App](http://itunes.apple.com/us/app/dash-docs-snippets/id458034879?mt=12) worth a try. Dash incorporates almost every documentation you'll ever need, makes them searchable, stores them locally and integrates with stackoverflow and google like a boss. Try it, buy it!
IDEs
For IDEs: choose what you like the most. We prefer [PyCharm](http://www.jetbrains.com/pycharm/): **positive** * Superb autocompletion, even in templates, CSS and LESS files * Easy to use debugger, also allows remote debugging * Good Django integration: Launch Scripts, manage.py tasks, python console **negative** * Slow startup * Ugly project / workspace settings which are saved in the project directory (must .gitignore). We also use TextMate as a quick and dirty file editor, when launching PyCharm would be overkill. By the way: If you aren't already a user of [LiveReload](http://livereload.com/), you should be a little embarrassed.
requirements.txt
Just as with [south](http://south.aeracode.org/), don't ask - just do: Always work with virtualenv and freeze your installed apps and requirements to the requirements.txt file. I will save your live when you have to make adjustments a couple years later. And deploying your app will be much easier.
Django Start Script
Our designers are not always as comfortable with working in the terminal as we are. In order to allow them to make quick changes to the .less, .js and .html files we made a little script that installs a virtualenv (if necessary), installs all requirements, applies all database migrations and launches the server. Here's the script we use - just put it in the same directory as manage.py. On OSX, files with the .command extension can be launched from the finder by doubleclick. **start.command** #! /bin/sh clear echo "STARTING UP" cd "`dirname "$0"`" echo "First run - would you like to setup the environment? (y/n)" read -n 1 name; if [ "$name" == "y" ]; then echo "Setting up virtualenv..." virtualenv venv --distribute fi echo "Upgrading requirements..." source venv/bin/activate pip install -r requirements.txt echo "Migrating database..." export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 python manage.py syncdb --settings=settings_dev python manage.py migrate --settings=settings_dev echo "Launching server..." python manage.py runserver 0.0.0.0:8000 --settings=settings_dev
Drag&Drop & MPTT
MPTT is incredible useful when requiring tree structures in a django app. It is even more awesome by using [django-treeadmin](https://github.com/piquadrat/django-treeadmin). This app enables you to drag&drop mptt model instances in the django admin. It is based on the feinCMS framework. * Install django-treeadmin: pip install django-treeadmin pip freeze > requirements.txt * Add treeadmin to your apps in your settings.py file * In your admin.py file, add the following: from treeadmin.admin import TreeAdmin class MyModelAdmin(TreeAdmin): pass site.register(models.MyModel, MyModelAdmin) Now you can drag&drop MPTT models in your django admin interface.
Using an editor like [Poedit](http://www.poedit.net/) will help you translate your app and validate your translation.
Django & Thumbnails
Unfortunately, django does not yet support thumbnail generation itself, therefore many thumbnail generator apps exists. The most simple one we found is [sorl-thumbnail](http://sorl-thumbnail.readthedocs.org/en/latest/index.html). Here's how to add it to your project: **Terminal:** pip install sorl-thumbnail pip freeze > requirements.txt **settings.py:** * Add sorl-thumbnail to your installed apps. * While being in your development environment: THUMBNAIL_DEBUG = True **Terminal:** python manage.py syncdb **In your template code:** {% thumbnail model.image "64x42" crop="center" as im %} {% endthumbnail %}
Media & Static Urls
Media and static resource locations are used for * media: Uploaded resources * static: Static resources, CSS, JS, Sprites, you name it. **settings.py** Introduce a new variable PROJECT_PATH to dynamically determine the path in the file system. This will help you when deploying against a production environment: import os.path PROJECT_PATH = os.path.dirname(os.path.abspath(__file__)) MEDIA_ROOT = os.path.join(PROJECT_PATH, 'media') MEDIA_URL = 'media' STATIC_ROOT = os.path.join(PROJECT_PATH, 'static') STATIC_URL = '/static/' **urls.py** Use the following patterns in your urls.py for development: #static urlpatterns += staticfiles_urlpatterns() #media urlpatterns += patterns('', (r'^media/(?P.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), Note: While being in development mode, you must not execute _manage.py collectstatic_. An article about production-configuration will be posted soon.
debug check in templates
You'll often run in situations where you need to load certain javascript while in development but not while in production mode (for example livereload). Django gives you a tag which you can test against but only if you have adjusted the following variables in your settings file: INTERNAL_IPS =\ ( '127.0.0.1', '0.0.0.0', 'localhost' ) DEBUG = True TEMPLATE_DEBUG = DEBUG Make sure you have a valid RequestContext in your template by using from django.shortcuts import render render(request,SOME_TEMPLATE_NAME) in your views. After that you can check if you are in debug mode: {% if debug %} document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>') {% endif %}
I18N
I18N is always a source of confusion, especially with new people on a project. Here a short guide for adding I18N to your project. Make sure you have **gettext** installed, use brew to install it if you haven't already. 1. **settings.py**: Add your supported languages and update LOCALE_PATHS LANGUAGES = ( ('de', 'German'), ('en', 'English'), ) LOCALE_PATHS = ( "YOUR_APP_DIRECTORY/locale", ) 2. Add an **empty locale folder** to your app directory. 3. In your base template, add the tag {% load i18n %} 4. and start using the trans tag to add translatable keys: {% trans "KEY NAME" %} 5. Open your terminal and **navigate to your app directory**. Execute the following commands: django-admin.py makemessages -l de django-admin.py makemessages -l en 6. Once the languages are added, you can use makemessages -a all to update the keys in the .po files. Next, update your .po files 7. Run the following command in your app directory: django-admin.py compilemessages 8. Restart your development server That's it.