| ⌘T | go to file |
| ⌘⌃P | go to project |
| ⌘R | go to methods |
| ⌃G | go to line |
| ⌘KB | toggle side bar |
| ⌘⇧P | command prompt |
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 SomeForm(forms.ModelForm): | |
| class Meta: | |
| model = SomeModel | |
| def __init__(self, *args, **kwargs): | |
| super(SomeForm, self).__init__(*args, **kwargs) | |
| if self.instance: | |
| print "There is an instance, so were editing." | |
| self.fields['anewfieldonlywhenediting'] = forms.CharField() |
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
| manage.py | |
| twitter_favorites | |
| -settings.py | |
| -urls.py | |
| -wsgi.py | |
| twitter_favs | |
| -templates/ | |
| -static/ | |
| -templatetags/ | |
| -models.py |
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
| filename = "filename123.txt" | |
| formattor = "%1d" | |
| filename_split = filename.split('.') | |
| new_filename = filename_split[0][:-1] + formattor | |
| new_filename = '.'.join([new_filename, filename_split[1]]) | |
| print new_filename |
If you get the "check dependencies error: There is no SDK with the name or path '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk'" error, the following steps should help:
- Download the MacOSX 10.6 SDK
- Extract the zip file
- Put the resulting folder in
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ - Then fix the
Build SettingsforyourProject.xcodeprojand theopenFrameworksLib.xcodeprojto have theBase SDKpointing at 10.6 - Restart XCode and compile again
- Now it should work!
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 direct.showbase.ShowBase import ShowBase | |
| import direct.directbase.DirectStart | |
| from direct.gui.OnscreenText import OnscreenText | |
| from direct.gui.DirectGui import * | |
| from panda3d.core import * | |
| class Directs(ShowBase): | |
| # rbuttonFrame = DirectFrame(pos = (-1, 0, 0.40)) | |
| _LABELS = ["Strongly do not want to continue", "Do not want to continue", |
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 scale_value(value_to_scale, original_min, original_max, target_min, target_max): | |
| return (((target_max - target_min) * (value_to_scale - original_min))/(original_max - original_min)) + target_min |
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
| # http://stackoverflow.com/a/656328/170172 | |
| from django import template | |
| register = template.Library() | |
| @register.tag | |
| def active(parser, token): | |
| args = token.split_contents() |
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
| #!/usr/bin/env sh | |
| ## | |
| # This is script with usefull tips taken from: | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # | |
| # install it: | |
| # curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
| # |
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
| #!/usr/bin/env bash | |
| function start_runserver_plus() { | |
| cd /path/to/project/dir && workon myvenv && python manage.py runserver_plus 0.0.0.0:8000 --traceback -v 3 --threaded | |
| } | |
| function rs() { | |
| # lsof -i :8000 lists processes using the 8000 port, -t option returns only the process ID | |
| d_pid=`lsof -t -i :8000` | |
| if [[ $d_pid ]]; then |
OlderNewer