From my talk on learning HAML and SASS for Magma Rails 2011.
Slides and an HTML reference version below. A sample application with all code examples is at https://github.com/jonathandean/SASS-and-HAML-FTW.
Slides and an HTML reference version below. A sample application with all code examples is at https://github.com/jonathandean/SASS-and-HAML-FTW.
This should probably work for any version but 8.4 is what I needed and tested.
I searched for how to use delayed_job and Rails 3 on Google last night and went down a little rabbit hole I thought I could try to help someone else avoid. I ended up at http://www.dixis.com/?p=335 which provided a great, but out of date, article on how to do this. It recommends using collectiveidea’s fork of delayed_job in the master branch, but as it turns out the latest in the master branch in is in flux at the moment. The ActiveRecord backend is currently being abstracted into it’s own gem (which is a great idea) but that means the generators to make the database tables are no longer there. It also in general seems not ready for prime time.
I added a jQuery plugin that I wrote a while ago that turns a checkbox into one that selects or deselects other checkboxes on the page. Example HTML and CSS to follow.
I added a new jQuery plugin that will fix an element to the top of the browser window once you scroll past it, similar to the functionality of the actions bar in the newest gmail UI.
Find it at https://github.com/jonathandean/jquery.fixOnScroll
Update: The right sidebar (on this page only) should move down as you scroll past it in the browser window. Depending on your window size, you may need to shorten the height of your browser to see it. The code for this is simply:
$(document).ready(function(){
$('#sidebar').fixOnScroll();
});
There are more usage examples on the README page of the git repository
Some older versions of Selenium RC don’t work properly with the new Firefox 4 (we are using 1.0.3 I believe.) The best solution is to upgrade your version of Selenium to at least 1.0.4 I’m told, but we aren’t able to do that for our project. So here is a way you can run Firefox 3 and 4 on the same computer so that you can use Firefox 4 as your primary browser and allow Selenium to launch Firefox 3 (even while Firefox 4 is already running.) For the moment I’m short on time so you’ll have to refer to some external articles and change a few of the steps. Time permitting I will try to consolidate all steps into this article to make things easier to follow and just in case those articles become unavailable at some point.
Here are my slides from my presentation at Magma Rails. Please feel free to make suggestions, corrections or ask questions via the comments or using the contact page.
Install fink
First we’re going to install fink as it will provide an OS X-ready version of meld for us (and quite a number of other UNIX programs as well). At the moment you’ll need to install fink from source for Snow Leopard (OS X 10.6). If you’re using another version of OS X there are binaries available for 10.1 to 10.5 on the main downloads page. The download for the source version is located at http://www.finkproject.org/download/srcdist.php. The latest version at the time of this writing is 0.29.10 and can be found directly at http://downloads.sourceforge.net/fink/fink-0.29.10.tar.gz. Download and save that file somewhere.
Today I was working in two separate branches in git and wrote a jQuery plugin that was useful to both branches. The problem was that I committed this new file along with changes to other files in order to use it. So I didn’t want to use cherry-pick to grab the commit because I didn’t want the other changes from that commit. There’s also the case where there are many commits involving that file in the other branch and you just want the most up to date version of that file. Turns out there’s a simple way to merge the latest version of a file (or even multiple files) from another branch into yours. Just follow this syntax:
git checkout <other branch name> <path(s) to file(s)>
Example of a single file:
git checkout new_feature public/javascripts/jquery.newplugin.js
Example for multiple files:
git checkout new_feature public/javascripts/jquery.newplugin.js public/stylesheets/jquery.newplugin.css
Then you can commit and you’ll have that file in your branch without causing any git ugliness.
Resource (and a little more detail) on Jason Rudolph’s blog.
Today I finally clicked the auto-upgrade button to upgrade my WordPress site to the newest version, 3.0.1. I then noticed that I wasn’t seeing the content of a lot of my pages. I could still see the lists of posts but I wasn’t getting anything on a single post or normal page. I verified the data was in the database.
Here’s what my page.php looked like:
<?php get_header(); ?> <div id="pageWrapper"> <h2><?php the_title(); ?></h2> <?php the_content(); ?> </div> <?php get_footer(); ?>
This was all fine and dandy for WordPress 2.x but obviously wasn’t working for 3.0. Turns out the solution is quite simple. I just need to put the_content() back into "the loop":
<?php get_header(); ?> <div id="pageWrapper"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <h2><?php the_title(); ?></h2> <?php the_content(); ?> <?php endwhile; endif; ?> </div> <?php get_footer(); ?>
I’m not sure why the change but I suppose I should have always explicitly used "the loop". Maybe I was taking advantage of a bug this whole time? Or maybe this was an intentional change that I should have seen coming. At any rate, if you see your content missing after an upgrade, take a look at your theme and make sure the_content() is always inside "the loop".