Calculate an MD5 Hash in Objective-C

First place this line after the UIKit #import of the .h file:

And then add this function to your .m file:

Use it like:

 

Prevent First TableViewCell to be Sorted Over or Moved in UITableView

I was creating a small todo app for fun, had a UITableView Set Up populated by an SQLite database, wanted to keep the first cell the “Inbox” and have it not be moved, or have any other cell be able to be sorted above it. After hours of trying to figure out the method to do this I figured out that a few things needed to be done in a few methods:

First, tell the <b>canMoveRowAtIndexPath</b> method that the first row can not be moved when the table is in edit mode:

Second, tell the <b>canEditRowAtIndexPath</b> that the row can not be deleted:

Finally, tell the <b>targetIndexPathForMoveFromRowAtIndexPath</b> method to not let anything be dragged above the first cell, but let the rest of the cells swap any where else they want:

Hope this helps anyone that was having the same problem.

Prevent Double Submit on Forms with jQuery

The following snippet disables the submit button of all forms in scope of the function after the submit button has been initially clicked. To prevent users from submitting your forms more than once.

How does it work?

When the submit button of the form is clicked, it triggers the form submit function of jquery, then takes the submit handler of the current form and makes it return false so it can’t submit the same form again.

Equal Column Heights with jQuery

The function:

This function loops through each of the elements passed in as parameters and sets each one equal to the tallest element in the group.

Usage:

 

Zebra Stripe a Table or List with jQuery

This snippet lets you strip the even/odd rows of your tables/lists different colors for easier reading:

 

Enable HTML5 Markup on Older Browsers

HTML5 is definitely the future of client-side web development. Unfortunately, some old browsers do not even recognize new tags such as header or section. This code will force old browsers to recognize the new tags introduced by HTML5.

A better solution is to link the .js file to the <head> part of your HTML page:

Source: http://remysharp.com/2009/01/07/html5-enabling-script/

Convert an Image to Grayscale in HTML/CSS

First create a file called filters.svg with the following code:

The CSS:

Customize UINavigationBar Background Property

Make sure you replace the two lines that create the UIImages with your image names.
Copy And paste the function into your app delegate right above applicationDidFinishLaunchingWithOptions:
then simply call [self customizeAppearance];  inside your app delegate:

 

Deselect UITableViewCell on Load

If you’ve ever paid attention to mail.app in iOS, when you navigate back to the main table view of mail items, the items that you previously selected shows for a second then deselects itself and animates out. Here’s how to do that:

UITableView Delegate Methods

UITableViews work better as subclasses of UIViews instead of a stand along UITableView classes. One prime example is with iAds, in order to configure them correctly and have them display at the bottom of your table and not over the last cell, the UITableView needs to be a subview of a UIView class. No need to create a new UITableView subclass just to get the delegate methods. Copy and paste the UITableView delegate methods from below and paste into your classes implementation file: