1 2 3 4 5 6 7 8 9 | |
Call it like so:
1
| |
That’s one way to do it anyway.
1 2 3 4 5 6 7 8 9 | |
Call it like so:
1
| |
That’s one way to do it anyway.
function makeItRain (effect) {
$('#something')[effect]();
}
makeItRain('slideToggle');
Note the lack of a ’.’ and the ’[]’s.
If you already have a /usr/local folder and it’s not owned by your user:
sudo chown -R `whoami` /usr/local
Install Homebrew:
cd /usr/local
git init
git remote add origin git://github.com/mxcl/homebrew.git
git pull origin master
This is kind of odd–you install Homebrew right into the base of your /usr/local folder. It nicely ignores other folders that already exists there. Just do it.
Install MySQL:
brew install mysql
Yeah, it’s really that easy. This will take a while.
Now warm it up:
mysql_install_db
And make sure it automatically starts again on login:
launchctl load -w /usr/local/Cellar/mysql/5.1.43/com.mysql.mysqld.plist
I keep having to look this up.
To add the mate shell command, select the Help menu from within TextMate and select "Terminal Usage..."
First, create a Git subfolder inside your Dropbox folder. Then you can share the individual projects inside that folder with whomever you want (or just use it for instant offsite backups).
From inside a Git project:
git clone --bare . ~/Dropbox/Git/gitproject.git
git remote add dropbox ~/Dropbox/Git/gitproject.git
When you’re ready to push:
git push dropbox master
Your collaborator would work on the project like so (inside the folder where they want their project to live):
git clone ~/Dropbox/Git/gitproject.git
If they want to have a dropbox remote instead of the default origin:
git remote add dropbox ~/Dropbox/Git/gitproject.git
They would then push the same way:
git push dropbox master
To get the other person’s changes, it’s the standard deal:
git pull dropbox master
sudo easy_install Sphinx
Inside your local SVN checkout of Django:
cd docs
make html
Now you’ll have a beautiful local copy of the documentation to browse for those rare moments when you’re away from the internet (perhaps you’re in a fort?). Just point your browser to:
file:///path/to/your/django/docs/_build/html/index.html
/Library/Python/2.6/site-packages (Leopard used 2.5)
After all that Sequel Pro is still showing the version of MySQL as 5.1.33, but it seems to be working…
This was by far the biggest headache. I finally found a solution:
Install like this, but before running sudo python setup.py install, do this:
LDFLAGS="-arch ppc -arch i386 -arch x86_64" CFLAGS="-arch ppc -arch i386 -arch x86_64" python setup.py build
If you already had PIL installed and had the source files you compiled from before, be sure to delete them and start fresh from a new Imaging-1.1.6.tar.gz.
Here’s another look into the development of ComicBinder.
There’s already a good tutorial on how to use an autocomplete plugin with Django, but I wanted to use this much snazzier plugin.
Load both jquery.autocomplete.min.js and jquery.autocomplete.css in your page.
In your form object, create a CharField to hold your autocomplete. Something like:
1
| |
Create a hidden field to hold the primary key of the item you’re selecting (so you don’t have to depend on searching against a ‘name’ field or something else equally brittle):
1
| |
Create a view to populate the autocomplete list:
1 2 3 4 5 6 7 8 9 10 11 | |
This will, of course, need a URLconf:
1
| |
And to finish it off, a bit of JavaScript in your template to call the plugin:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | |
While building ComicBinder’s URLs, I wanted a way to differentiate a volume of a title other than one, and a printing of an issue other than one. So, for example, a URL to the second printing of the second volume of Amazing Spider-Man #1 would look like:
/marvel/amazing-spider-man_2/1_2/
That’s easy enough with some URLconf wrangling. What I’m talking about today is automatically redirecting a request for _1 in any of those places to the same URL without the _1. While technically correct, I want the lack of underscore + number to mean one, and for there to be only one URL for a resource (someone send me a link to a clever article that talks about this).
django.views.generic.simple.redirect_to to the rescue. Try something like this:
(r'^(?P<publisher>[-\w]+)/(?P<title>[-\w]+)_1/(?P<number>\d+)_1/$', 'django.views.generic.simple.redirect_to', {'url': '/%(publisher)s/%(title)s/%(number)s/'}),
I made a few of these to account for situations where it was the first volume, but nothing specified for printing, and vise versa.
Not too bulky, and since I have that sitting near the normal rule, it shouldn’t put me out too much to update it if I make any changes.
Somewhere in your Python code (not a template):
import logging
logging.debug(something_you_want_to_log)
Somewhere in your JavaScript or the Firebug Console:
console.log(something_you_want_to_log);
That was easy.