Code Snippets

Page 8 of 8
<< Previous   4 | 5 | 6 | 7 | 8
Code Snippets

MySQL find and replace all instances of a string

In this post I'm going to look at how to find which tables in a MySQL database a string is referenced, and how to to replace all instances of that string using MySQL's replace function.

Code Snippets

Clearing all javascript timeouts

This post looks at a couple of different implementations of clearing multiple javascript timeouts.

Code Snippets

jQuery animate easing options

jQuery's animate function allows you to create movement effects of page elements using their CSS selector. One of the parameters for the animate function is 'easing' which allows you to control the type of movement. By default, the easing effect will be set to 'swing', the only other option available with the jQuery core is 'linear', however adding jQuery UI opens up a whole load more options. This article takes a look at what's available and how to use it.

Code Snippets

CSS force a side scroll bar

Forcing a scrollbar on your web site can prevent that 'jumpy' effect when some pages have one but others do not when the content isn't deep enough. This short code snippet will help to keep all the pages consistent:

Code Snippets

How to alternative list item background colour

In the old days, alternating the background colour in a list item would involve adding alternating classes with different background-color properties applied. With CSS3 this can now be achieved with the nth-child selector.

Code Snippets

Remove class attribute after using jQuery removeclass function

So I noticed some odd jQuery behavior the other day. When using the .removeClass() method it leaves behind an empty 'class' attribute title which is both unnecessary and invalid code (were you to run this through a validator you would get "CLASS" is not a member of a group specified for any attribute). This code snippet looks at how you can get rid of the empty class attribute after using the jQuery removeClass method.

Code Snippets

jQuery ubinding a click event after first click

This article looks at using jQuery unbind to remove a click event after the first click. As an example we'll be creating a simple search box the gets displayed on first click and would do the search on second click.

Code Snippets

Sort an array by value in PHP

Sorting arrays in PHP is easy with several built in functions to cater for different re-ordering methods.

Code Snippets

Connected Multiselect Boxes

The following code snippet is a quick and easy way to selectively create a list from options in a secondary multiselect box. As it's multiselect you'll be able to move more than one option to the other list at the same time.

Code Snippets

Getting a child class name without namespaces

Code snippet for retrieving a child class name from the parent without the namespace.

Page 8 of 8
<< Previous   4 | 5 | 6 | 7 | 8
Sign Up

Popular Tags

350x250

Need a web developer?

If you'd like to work with code synthesis on your next project get in touch via the contact page.