Enable Or Not To Enable

With fixed pipeline, you needed to call glEnable(GL_TEXTURE_2D) to enable 2D texturing. You needed to call glEnable(GL_LIGHTING). Since shaders override these functionalities, you don't need to glEnable/glDisable. If you don't want texturing, you either need to write another shader that doesn't do texturing or you can attach a all white or all black texture, depending on your needs. You can also write one shader that does lighting and one that doesn't.

Things that are not overriden by shaders, like the alpha test, depth test, stencil test... calling glEnable/glDisable will have an effect.

Binding A Texture

When you compile and link your GLSL shader, the next step is to get uniform locations for your samplers (I'm talking about texture samplers) and setup the samplers. Some people do this:

glUniform1i(location, textureID)

You can't send a GL texture ID as your sampler. A sampler should be from 0 to the max number of texture image units.
Once you compile and link your shader, make sure that you setup all the samplers by calling
(assuming of course your samplers are named Texture0, Texture1 and Texture2

If you don't set the samplers properly, you might get a link failure that says

Output from shader Fragment shader(s) linked, vertex shader(s) linked.
Validation failed - samplers of different types are bound to the same texture i
mage unit.

Types

nVidia drivers are more relaxed. You could do

float myvalue = 0;

but this won't compile on other platforms. Use 0.0 instead.
Don't write 0.0f. GLSL is not C or C++.

float texel = texture2D(tex, texcoord);

The above is wrong since texture2D returns a vec4
Do this instead

float texel = float(texture2D(tex, texcoord));

or

float texel = texture2D(tex, texcoord).r;

or

float texel = texture2D(tex, texcoord).x;

Functions

Functions should look like this

vec4 myfunction(inout float value1, in vec3 value2, in vec4 value3)

instead of

vec4 myfunction(float value1, vec3 value2, vec4 value3)

Not Used

In the vertex shader

gl_TexCoord[0] = gl_MultiTexCoord0;

and in the fragment shader

vec4 texel = texture2D(tex, gl_TexCoord[0].xy);

zw isn't being used in the fs.
Keep in mind that for GLSL 1.30, you should define your own vertex attribute.
This means that instead of gl_MultiTexCoord0, define AttrMultiTexCoord0.
Also, do not use gl_TexCoord[0]. Define your own varying and call it VaryingTexCoord0.

Easy Optimization

Keep in mind that for GLSL 1.30, you should define your own vertex attribute.
This means that instead of gl_MultiTexCoord0, define AttrMultiTexCoord0.
Also, do not use gl_TexCoord[0]. Define your own varying and call it VaryingTexCoord0.

The MAD instruction

MAD is short for multiply, then add. It is a special floating point circuit. Very fast. Costs 1 GPU cycle.

The above doesn't quite easily turn into a MAD. It might be compiled to a reciprocal, then add. That might cost 2 or more cycles.
Below is GLSL code that converts to a single MAD instruction (for each line of code of course)

Of course, your GLSL compiler might be smart enough and optimize the above simple example for you but code it right yourself!

Linear Interpolation, lerp, mix

This is more about being aware of built in functions of GLSL and making use of them so that your GLSL compiler easily generates the "low level hardware executable".
Blending 2 values based on some factor

and of course, GPUs have a special instruction just for this common case. GLSL calls it mix while other languages like Cg calls it lerp.

resultRGB = mix(colorRGB_0, colorRGB_1, alpha);

GL_LINE_SMOOTH, GL_POINT_SMOOTH , GL_POLYGON_SMOOTH

If you have any of these enabled, it is known that this causes software mode rendering on ATI/AMD.
You should not even need these. Enable fulscreen MSAA instead.

Compile GLSL

This should be in the FAQ but for now, we'll leave it here.Can you compile a GLSL program using some offline compiler?
Yes, by using the Cg compiler.
The Cg compiler not only compiles Cg code, but it can also do translations from one language to another, also called the target language.
You would have to download the Cg package which contains the compiler from developer.nvidia.com
Once install, using the command line, type

cgc -oglsl -profile vp40 test.glsl_vs

That means your file test.glsl_vs contains your GLSL vertex shader and your target is GL_NV_vertex_program4 (also called vp40), so it should print out the shader on screen.
The Cg compiler also supports other targets like arbvp and arbfp and vp10, vp20, vp30, and the fp version as well.

There is no official offline compiler for OpenGL. The ARB didn't intend for this. Normally, you would just send your GLSL code to GL and the GL driver compiles the program, generates a GPU specific binary code, which eventually gets uploaded to the GPU when you decide to use it.

Keep in mind that if you send the GLSL shader code to GL, the driver compiles using the CPU. Compiling a shader is slow. The longer the shader, the more CPU time it takes. The driver does its best to optimize your code and to get rid of dead code. The more shaders you have, the more time it takes. If each shader takes 100ms to compile and you have 10 shaders, it will take 1 second. 60 shaders will take 1 minute. 600 shaders will take 10 minutes. These are rough estimates. They are intended to inform you that you'll be facing a problem when you write a large project.

glUniform doesn't work

You probably did not bind the correct shader first. Call glUseProgram(myprogram) first.

glUniform causes a slow down

This should go in the FAQ but we'll leave it here.
All the glUniform calls are relatively fast except that it has been reported that on some nVidia drivers, when certain values are sent to the shader, the driver recompiles and reoptimizes your shader. This is obviously a problem for games. Values are 0.0, 0.5, 1.0. There is no solution other than to avoid those exact numbers. Has nVidia solved this issue in recent drivers? Unknown.

How to use glUniform

If you look at all the glUniform functions (glUniform1fv, glUniform2fv, glUniform3fv, glUniform4fv, glUniform1iv, glUniform2iv, glUniform3iv, glUniform4iv, glUniformMatrix4fv and the many others), there is a parameter called count.

Uniform Names in VS, GS and FS

This should go in the FAQ but we'll leave it here.
So what happens if you have the same exact uniform name is in both the vertex shader and geometry shader and fragment shader?

Yes, it is legal to have the same uniform name in all shaders.
When you call glGetUniformLocation, it will return one location. When you update the uniform with a call to glUniform, the driver takes care of sending the value for each stage (vertex shader, geometry shader, fragment shader).
This is because a GLSL shader is considered monolithic : the VS, GS and FS is considered as 1 shader.

Keep in mind that this applies to all uniforms : float, vec2, vec3, vec4, mat3, mat4, bool, sampler2D, sampler3D and the many others.

glUseProgram(0)

This should go in the FAQ but we'll leave it here.
So what happens when you supply 0 to glUseProgram? The specification says that you go back to fixed function pipeline processing. All the old functions take effect (glTexEnv, glEnable(GL_TEXTURE_2D), glLight, glMaterial, glEnable(GL_LIGHTING) and others).

It is highly recommended that you use shaders for all your rendering needs. All GPUs support shaders. They all support GL 2.0 or 2.1 or 3.0 and above these days.
Note : when you first create a GL context, you are in fixed function mode (glUseProgram(0)) and should bind a shader before rendering.

Optimization

At the bottom of the common mistakes page, we will just discuss optimizations.

Assume that you want to set the output value ALPHA to 1.0. Here is one method :