http://formatmysourcecode.blogspot.com/
Basically you just need to paste the codes there, and it'll return the "correct" formatting for you. And then you can paste them back to your post editor.
Here's an example of it:
{
polySelectConstraint -m 3 -t 0x8000 -w 1 ;
polySelectConstraint -dis;
$selection = `ls -sl -fl -l` ;
string $borderShell[];
int $borderSize[];
int $currSize=0;
for($currID= 0;$currID<size($selection);$currID++)
{
if($selection[$currID]=="")
continue;
$borderShell[$currSize] = $selection[$currID];
string $tmp[]=`polyListComponentConversion -fe -tv $selection[$currID]`;
string $verts[]=`ls -fl $tmp`;
int $found=0;
int $iter=0;
int $maxIter = 20000;
do
{
$found=0;
for($nID = 0;$nID<size($selection);$nID++)
{
if($selection[$nID]=="")
continue;
if($selection[$nID] == $selection[$currID])
continue;
$tmp=`polyListComponentConversion -fe -tv $selection[$nID]`;
string $nVerts[] = `ls -fl $tmp`;
for($i=0;$i<size($verts);$i++)
{
for($j=0;$j<size($nVerts);$j++)
{
if($verts[$i] == $nVerts[$j])
{
$borderShell[$currSize] = $borderShell[$currSize] + " " + $selection[$nID];
$selection[$currID]="";
$selection[$nID] = "";
$j =!$j;
$verts[$i] = $nVerts[$j];
$found=1;
break;
}
}
if($found)
break;
}
if($found)
break;
}
$iter+=1;
}while($found && $iter<$maxIter);
$currSize+=1;
}
print $borderShell;
}
The example codes above are mel codes. The usage is to organize border edges into each separate border shells.