Ignore Git files that already exist in the repository
I made changes to some config files for dev purposes. And I didn’t want to commit that back into git. The problem is that .gitignore
and .git/info/exclude
don’t work on a file already in the repository. So after googling a bit, I found a way to do this here: http://justaddwater.dk/2009/12/07/how-to-make-git-ignore-files-that-already-exist-in-your-project/
And here’s the command from that link:
git update-index --assume-unchanged config/database.yml
Of course you won’t be able to update that file until you do:
git update-index --no-assume-unchanged config/database.yml
The doc on this command is here: http://www.kernel.org/pub/software/scm/git/docs/git-update-index.html
Set up nginx and php-fpm to run symfony
I wanted to set up a generic nginx configuration for my symfony development environment. The way my dev box is set up, I have symlinks in /var/www
to the web directory of each of my projects. That way I can access them like http://localhost/project1/frontend_dev.php/
, etc.
This isn’t so hard to set up on ubuntu 10.10. Just install nginx
and php-fpm
with apt-get. I made one little tweak to php-fpm, I configured it to use a unix socket instead of a local port.
Open /etc/php5/fpm/pool.d/www.conf
with your favorite editor and edit the listen line to this:
listen = /var/run/php-fpm.socket
Then tweak the nginx site config file vim /etc/nginx/sites-enabled/default
, this is what I got working for me:
server { listen 80; root /var/www/; index index.php,index.html,index.htm; autoindex on; charset utf-8; location / { # If the file exists as a static file serve it directly without # running all the other rewite tests on it if (-f $request_filename) { expires 1m; break; } # if ($request_filename !~ "\.(js|htc|ico|gif|jpg|png|css)$") { # rewrite ^(.*) /index.php last; # } } location ~ \.php($|/) { set $script $uri; set $path_info ""; if ($uri ~ "^(.+\.php)($|/)") { set $script $1; } if ($uri ~ "^(.+\.php)(/.+)") { set $script $1; set $path_info $2; } fastcgi_pass unix:/var/run/php-fpm.socket; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_NAME $script; fastcgi_param SCRIPT_FILENAME /var/www$script; fastcgi_param PATH_INFO $path_info; } }
I still haven’t gotten it to work with automatically adding index.php. (That part is commented out in the nginx config above.) I think it’s because I’ve kept it generic to serve all kinds of files and multiple symfony apps – not just one symfony app. So it would probably need some work for production (there’ll probably be a virtual host on production anyway). But I use frontend_dev.php, etc for all my development.
Changing Aptana 3’s Default Workspace
Aptana 3 locks eclipse’s workspace to ~/Aptana 3 Workspace
. Aptana does let you change it after starting Aptana, but it will always load the above workspace when it starts. Here’s how to change that to always load a different workspace at startup.
Go to the directory where the Aptana binary is, and edit configuration/config.ini
, and change the line that looks like this to whatever you want:
osgi.instance.area.default=@user.home/Aptana 3 Workspace
This was found here, which also shows you how to move your rubles: http://danielsmedegaardbuus.dk/2010-08-31/be-gone-stupid-aptana-studio-3-folders-in-my-home-directory/
Clickable rows in jQuery
Found a nice post about making the entire <tr> clickable using jQuery. http://imar.spaanjaars.com/549/how-do-i-make-a-full-table-row-clickable-using-jquery It pulls the link from the <a> tag in the first column. But I made a couple modifications to it to my liking, posted here.
The html code:
<table> <thead> <tr> <th>Id</th> <th>Name</th> </tr> </thead> <tbody class="row_clickable"> <tr> <td><a href="edit/1">1</td> <td>First Item</td> </tr> <tr> <td><a href="edit/2">2</td> <td>Second Item</td> </tr> </tbody> </table>
This jQuery below will use the first <a> in the first <td> for the link. And if you want to optionally hide that column at the same time, you can add the class hide_link
to the <tbody>.
<tbody class="row_clickable hide_link">
Here’s the jQuery:
$(function(){ // clickable rows on tables $('.row_clickable.hide_link tr td:first-child, '+ '.row_clickable.hide_link tr th:first-child').hide(); $('.row_clickable tr').hover(function(){ $(this).toggleClass('highlight'); }); $('.row_clickable tr').click(function(){ location.href = $(this).find('td a').attr('href'); });});
And a little css:
.row_clickable tr{ cursor:pointer; } .row_clickable tr.highlight, .row_clickable tr.highlight td, .row_clickable tr.highlight th{ background-color:#ee9; }