Ruby 浓度工作室12天愚蠢的Ruby技巧

class Array def shuffle n = [] while !empty? n << delete_at(rand(size)) end n end end # Usage >> [1,2,3,4,5].shuffle => [2, 4, 5, 1, 3]

JavaScript 向左移动模块向右移动

<!-- start code provided by createblog.com -->
<script language="Javascript">
// original by sean http://www.xanga.com/seanmeister
var tds = document.getElementsByTagName("td");
for (var i = 0; i < tds.length; i++){
if (tds[i].width == "200"){
tds[i].parentNode.appendChild(tds[i].cloneNode(true));
tds[i].parentNode.removeChild(tds[i]);
break;
}}
</script>
<!-- end code provided by createblog.com -->

HTML 灰度图像

<!-- start code provided by createblog.com -->
<img src="yourimagehere" style="filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)" onmouseover="this.style.filter = 'progid:DXImageTransform.Microsoft.BasicImage(grayscale=0)'" onmouseout="this.style.filter = 'progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)'">
<!-- end code provided by createblog.com -->

HTML 雪域皮肤*改善*

<div align=left><style type="text/css">body {/* this belongs to mrawr_layouts */background: url(http://img401.imageshack.us/img401/6292/4hs2ddxeg9.png);background-repeat: no-repeat;  background-attachment: fixed;  background-position: center right; background-color: #000000; scrollbar-arrow-color: #ffffff; scrollbar-track-color: #000000; scrollbar-shadow-color: #000000; scrollbar-face-color: #000000; scrollbar-highlight-color: #000000; scrollbar-darkshadow-color:  #000000; scrollbar-3dlight-color: #000000;  }.left, .blogbody, table.footer, .standard, .leftmodulefontcolor, td, p {/* main text */font:normal 12px verdana;line-height:13px; color: #c8966b;text-transform: normal; letter-spacing:0px; text-align:; }.blogbody b, .standard b, p b, strong {font-weight: bold;font-family: georgia;text-transform: ;font-size: 24px;line-height: 16px;letter-spacing: -2px;font-weight: lighter;color:  #683d1d;}.blogbody i, .standard i, p i, em {/*italics*/font-weight: normal;font-family: garamond;text-transform: ;font-size: 16px;line-height: 13px;letter-spacing: 1px;font-weight: normal;color: #ffffff;}.blogbody u, .standard u, p u, u {/*underlined*/font-weight: normal;font-family: verdana;text-transform: ;font-size: 13px;line-height: 13px;letter-spacing: 0px;font-weight: lighter;color:  #c1a366;border-bottom:  #c1a366 solid 2px;}table.footer TD {/* this makes the footer at the bottom centered *//* leave it as it is, unless you know what to do*/ text-align: center; }div.blogheader, .caption {/* edits the dates */  font:bold 12px verdana;  text-transform:lowercase;  line-height:10px;  color:#4e2811;  letter-spacing:1px;  background-color:#000000;  text-align: center;  width: 400px;background-image: url();background-repeat: no-repeat;  background-attachment: fixed;  background-position: top left;}a:link, .footernav.link, a.footernav:link, a.footernav:active {/* edits all links */ color:#86572a; font:normal 9px verdana;text-transform: lowercase; text-decoration: none; }a:visited, a.footernav:visited,  {/* edits the links that the user has visited */ color:#86572a;  font:normal 9x verdana;text-transform: lowercase; text-decoration: none; }a:hover {/* hover */ color:#4e2811; font:normal 9px verdana;text-transform: lowercase; text-decoration: none; }input, select, textarea, .textfield, .button {/* this edits the buttons, dropdowns, etc. */ font:normal 9px verdana; border: 0px solid #000000;text-transform: lowercase;color: #ffffff; background-color: #000000; letter-spacing:0px; }table.left { /* this edits the menu module */ border: 0px solid #000000; font:normal 9px verdana; color: #ffffff; width:170px;  background-color: transparent; }table.blogbody {/* blog */ background-color: #000000; width:400px;background-image: url();background-repeat: repeat;  background-attachment: fixed;  background-position: bottom right; }table.left th {/* on your menu module, this edits the title part of it *//* like BLOGRINGS, POSTING CALENDAR, etc */font-family: verdana;text-transform: uppercase;font-size:9px;font-weight: normal;letter-spacing: 0px;color: #4e2811;background-color: #000000;text-align: center;background-image: url();background-repeat: repeat;  background-attachment: fixed;  background-position: top left;  }table.left TD {/* on your menu module, this edits the body part of it */ background-color:#000000; font:normal 9px verdana; color: #ffffff;background-image: url();background-repeat: repeat;  background-attachment: fixed;  background-position: top left; }table.search TD, table.search, table.announcements {/* border of search bar (if you have it) */ background-color:#000000;  border: 0px solid #000000; }table.search TD, table.announcements TH {/* this should be left alone *//* unless you know what to do */ border: 0px solid white; }table.navigation, table.main, table.footer {/* the width of your blog with modules */ width: 400px; }hr {/* horizontal divider */ border: 1px solid ffffff;/* this belongs to mrawr_layouts */ }</style><!-- begin code provided by createblog.com --><style type="text/css">table.navigation, table.footer { display:none; }</style><!-- end code provided by createblog.com --><!-- begin code provided by createblog.com --><right><a href="http://www.xanga.com/">in</a><a href="http://www.xanga.com/Private/">mine</a><a href="http://www.xanga.com/mrawr_layouts">mrawr</a><a href="http://www.xanga.com/default.aspx?mode=logout">out</a></right><!-- end code provided by createblog.com -->

JavaScript 雪效应

/******************************************
* Snow Effect Script- By Altan d.o.o. (http://www.altan.hr/snow/index.html)
* Visit Dynamic Drive DHTML code library (http://www.dynamicdrive.com/) for full source code
* Last updated Nov 9th, 05' by DD. This notice must stay intact for use
******************************************/
  
  //Configure below to change URL path to the snow image
  var snowsrc="http://img226.imageshack.us/img226/9894/snow3gy1.gif"
  // Configure below to change number of snow to render
  var no = 12;
  // Configure whether snow should disappear after x seconds (0=never):
  var hidesnowtime = 0;
  // Configure how much snow should drop down before fading ("windowheight" or "pageheight")
  var snowdistance = "pageheight";
 
///////////Stop Config//////////////////////////////////
 
  var ie4up = (document.all) ? 1 : 0;
  var ns6up = (document.getElementById&&!document.all) ? 1 : 0;
 
    function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }
 
  var dx, xp, yp;    // coordinate and position variables
  var am, stx, sty;  // amplitude and step variables
  var i, doc_width = 800, doc_height = 600; 
  
  if (ns6up) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
  } else if (ie4up) {
    doc_width = iecompattest().clientWidth;
    doc_height = iecompattest().clientHeight;
  }
 
  dx = new Array();
  xp = new Array();
  yp = new Array();
  am = new Array();
  stx = new Array();
  sty = new Array();
  snowsrc=(snowsrc.indexOf("dynamicdrive.com")!=-1)? "snow.gif" : snowsrc
  for (i = 0; i < no; ++ i) {  
    dx[i] = 0;                        // set coordinate variables
    xp[i] = Math.random()*(doc_width-50);  // set position variables
    yp[i] = Math.random()*doc_height;
    am[i] = Math.random()*20;         // set amplitude variables
    stx[i] = 0.02 + Math.random()/10; // set step variables
    sty[i] = 0.7 + Math.random();     // set step variables
        if (ie4up||ns6up) {
      if (i == 0) {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><a href=\"http://dynamicdrive.com\"><img src='"+snowsrc+"' border=\"0\"><\/a><\/div>");
      } else {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");
      }
    }
  }
 
  function snowIE_NS6() {  // IE and NS6 main animation function
    doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
        doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")?  iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
    for (i = 0; i < no; ++ i) {  // iterate for every dot
      yp[i] += sty[i];
      if (yp[i] > doc_height-50) {
        xp[i] = Math.random()*(doc_width-am[i]-30);
        yp[i] = 0;
        stx[i] = 0.02 + Math.random()/10;
        sty[i] = 0.7 + Math.random();
      }
      dx[i] += stx[i];
      document.getElementById("dot"+i).style.top=yp[i]+"px";
      document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px";  
    }
    snowtimer=setTimeout("snowIE_NS6()", 10);
  }
 
    function hidesnow(){
        if (window.snowtimer) clearTimeout(snowtimer)
        for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
    }
        
 
if (ie4up||ns6up){
    snowIE_NS6();
        if (hidesnowtime>0)
        setTimeout("hidesnow()", hidesnowtime*1000)
        }
 
</script>

HTML Xanga布局 - 泡沫

<!-- Script by Mimz -->
<!-- Bubbles -->
<STYLE type="text/css">
body {
background-image:  URL(http://img91.imageshack.us/img91/2021/bubbles15qn.jpg);
background-repeat: repeat;
background-attachment: fixed;
background-position: center;
scrollbar-arrow-color: #C3B9FF;
scrollbar-track-color: transparent;
scrollbar-shadow-color:#000000;
scrollbar-face-color: #FFFFFF;
scrollbar-highlight-color: #C3B9FF;
scrollbar-darkshadow-color:#000000;
scrollbar-3dlight-color:#C3B9FF;
}
.left, .blogbody, table.footer, .standard, td, p {
/* edits main text */
font:normal 12px arial;
line-height:12px;
color: #000000;
letter-spacing:0px;
text-align:left;
}
.blogbody b, .standard b, p b, strong {
/* edits bolded text in your entry */
font-weight: bold;
color:#DD95FB;
}
.left b,{
font-weight:bold;
color:#DD95FB;
}
.blogbody u, .standard u, {
text-decoration: underline;
color:#F97AED;
}
.blogbody i, .standard i, em {
text-decoration:italic;
color:#F7B9AC;
font-weight:normal;
}
table.footer TD {
/* this makes the footer at the bottom centered */
/* leave it alone unless you know what to do*/
text-align: center;
}
div.blogheader, .caption {
/* edits the dates */
font-family: arial;
text-transform: lowercase;
background-color: transparent;
font-size:12px;
font-weight:none;
line-height: 12px;
letter-spacing:2px;
color: #DD95FB;
text-align:center;
padding:3px;
width: 280px;
border:2px solid #C3B9FF;
border-top:4px solid #C3B9FF;
border-right:4px solid #C3B9FF;
border-left:4px solid #C3B9FF;
}
a:link, .footernav.link, a.footernav:link, a.footernav:active {
/* edits all links */
color:#000000;
font:normal 12px arial;
line-height:12px;
text-decoration: none;
text-spacing:0px;
}
a:visited, a.footernav:visited, {
/* edits the links that the user has visited */
color:#000000;
font:bold 12px arial;
line-height:12px;
text-decoration: none;
text-spacing:0px;
}
a:hover {
/* edits when user mouseovers the links */
font:12px arial;
line-height:12px;
text-decoration: none;
color:#F7B9AC;
letter-spacing:0px;
}
input, select, textarea, iframe.htmleditor, .textfield, .button {
/* this edits the buttons, dropdowns, etc. */
border: 2px solid #C3B9FF;
font:normal 12px arial;
background-color: transparent;
letter-spacing:0px;
color:#000000;
}
table.blogbody {
/* this edits the other the place where the blog is */
border: 2px solid #C3B9FF;
border-top: 2px solid #C3B9FF;
width: 280px;
background-color: transparent;
}
table.left {
/* this edits the menu module */
border: 2px solid #C3B9FF;
width: 170px;
background-color: transparent;
text-align:center;
}
table.left th {
/* on your menu module, this edits the title part of it */
/* like BLOGRINGS, POSTING CALENDAR, etc */
background-color: transparent;
font: 12px arial;
line-height:12px;
text-transform:lowercase;
text-align:center;
color:#000000;
border: 2px solid #C3B9FF;
letter-spacing:2px;
}
table.left TD {
/* on your menu module, this edits the body part of it */
font:normal 12px arial;
color:#000000;
text-align:center;
LINE-HEIGHT:10PX;
border-top:2px solid #C3B9FF;
width: 170px;
background-color: transparent;
}
table.search TD, table.search, table.announcements {
/* border of search bar (if you have it) */
background-color: transparent;
border: 2px solid #C3B9FF;
}
table.search TD, table.announcements TH {
/* this should be left alone */
/* unless you know what to do */
border: 2px solid #C3B9FF;
}
table.navigation, table.main, table.footer {
/* the width of your blog with modules */
width: 470px;
}
hr {
/* horizontal divider */
border:2px #C3B9FF;
}
</style>
<!-- End Script by Mimz -->




<center><b><a href=http://www.xanga.com/Got_Layed>Wanna get layed?</a>

HTML Xanga布局 - 橙色油漆

<!-- Script by Mimz -->
<!-- Orange Paint -->
<STYLE type="text/css">
body {
background-image:  URL(http://img228.imageshack.us/img228/9644/orangepaint6vh.jpg);
background-repeat: repeat;
background-attachment: fixed;
background-position: center;
scrollbar-arrow-color: #000000;
scrollbar-track-color: #FFFFFF;
scrollbar-shadow-color:#000000;
scrollbar-face-color: #FFFFFF;
scrollbar-highlight-color: #000000;
scrollbar-darkshadow-color:#000000;
scrollbar-3dlight-color:#000000;
}
.left, .blogbody, table.footer, .standard, td, p {
/* edits main text */
font:normal 12px arial;
line-height:12px;
color: #000000;
letter-spacing:0px;
text-align:left;
}
.blogbody b, .standard b, p b, strong {
/* edits bolded text in your entry */
font-weight: bold;
color:#000000;
}
.left b,{
font-weight:bold;
color:#000000;
}
.blogbody u, .standard u, {
text-decoration: underline;
color:#000000;
}
.blogbody i, .standard i, em {
text-decoration:italic;
color:#000000;
font-weight:normal;
}
table.footer TD {
/* this makes the footer at the bottom centered */
/* leave it alone unless you know what to do*/
text-align: center;
}
div.blogheader, .caption {
/* edits the dates */
font-family: arial;
text-transform: lowercase;
background-color: #FF9900;
font-size:12px;
font-weight:none;
line-height: 12px;
letter-spacing:2px;
color: #000000;
text-align:center;
padding:3px;
width: 280px;
border:2px solid #000000;
border-bottom:1px solid #000000;
}
a:link, .footernav.link, a.footernav:link, a.footernav:active {
/* edits all links */
color:#FF6A00;
font:12px arial;
font-weight:bold;
line-height:12px;
text-decoration: none;
text-spacing:0px;
}
a:visited, a.footernav:visited, {
/* edits the links that the user has visited */
color:#FF6A00;
font:bold 12px arial;
line-height:12px;
text-decoration: line-through;
text-spacing:0px;
}
a:hover {
/* edits when user mouseovers the links */
font:14px arial;
line-height:14px;
text-decoration: none;
font-weight: bold;
color:#000000;
letter-spacing:2px;
}

a:hover img {
filter: gray;
padding: 0px;
}

input, select, textarea, iframe.htmleditor, .textfield, .button {
/* this edits the buttons, dropdowns, etc. */
border: 2px solid #000000;
font:normal 12px arial;
background-color: transparent;
letter-spacing:0px;
color:#000000;
}
table.blogbody {
/* this edits the other the place where the blog is */
border: 2px solid #000000;
border-top: 2px solid #000000;
width: 280px;
background-color: white;
{filter: alpha(opacity=70); -moz-opacity:70%;}
}
table.left {
/* this edits the menu module */
border: 2px solid #000000;
width: 170px;
background-color: white;
{filter: alpha(opacity=70); -moz-opacity:70%;}
text-align:center;
}
table.left th {
/* on your menu module, this edits the title part of it */
/* like BLOGRINGS, POSTING CALENDAR, etc */
background-color: #FF9900;
font: 12px arial;
line-height:12px;
text-transform:lowercase;
text-align:center;
color:#000000;
border: 1px solid #000000;
border-bottom: 0px solid #000000
letter-spacing:2px;
}
table.left TD {
/* on your menu module, this edits the body part of it */
font:normal 12px arial;
color:#000000;
text-align:center;
LINE-HEIGHT:10PX;
border-top:2px solid #000000;
width: 170px;
background-color: transparent;
}
table.search TD, table.search, table.announcements {
/* border of search bar (if you have it) */
background-color: transparent;
border: 2px solid #000000;
}
table.search TD, table.announcements TH {
/* this should be left alone */
/* unless you know what to do */
border: 2px solid #000000;
}
table.navigation, table.main, table.footer {
/* the width of your blog with modules */
width: 470px;
}
hr {
/* horizontal divider */
border:3px #000000;
}
</style>
<!-- End Script by Mimz -->


<center><b><a href=http://www.xanga.com/Got_Layed>Wanna get layed?</a>

HTML Xanga布局 - 忙碌的蜜蜂

<!-- Script by Mimz -->
<!-- Busy Bee -->
<STYLE type="text/css">
body {
background-image:  URL(http://img184.imageshack.us/img184/286/busybee10vb.jpg);
background-repeat: no-repeat;
background-attachment: fixed;
background-position: right;
scrollbar-arrow-color: #53C7EE;
scrollbar-track-color: #3A3A3A;
scrollbar-shadow-color:#00B5E2;
scrollbar-face-color: #53C7EE;
scrollbar-highlight-color: #FDD901;
scrollbar-darkshadow-color:#000000;
scrollbar-3dlight-color: #FFFFFF;
}
.left, .blogbody, table.footer, .standard, td, p {
/* edits main text */
font:normal 12px arial;
line-height:12px;
color: #FFFFFF;
letter-spacing:0px;
text-align:left;
}
.blogbody b, .standard b, p b, strong {
/* edits bolded text in your entry */
font-weight: bold;
color:#00B5E2;
}
.left b,{
font-weight:bold;
color:#00B5E2;
}
.blogbody u, .standard u, {
text-decoration: underline;
color:#53C7EE;
}
.blogbody i, .standard i, em {
text-decoration:italic;
color:#53C7EE;
font-weight:normal;
}
table.footer TD {
/* this makes the footer at the bottom centered */
/* leave it alone unless you know what to do*/
text-align: center;
}
div.blogheader, .caption {
/* edits the dates */
font-family: arial;
text-transform: lowercase;
background-color: transparent;
font-size:12px;
font-weight:none;
line-height: 12px;
letter-spacing:2px;
color: #00B5E2;
text-align:center;
padding:3px;
width: 280px;
border:2px dashed #FDD901;
border-top:4px dashed #FDD901;
border-right:4px dashed #FDD901;
border-left:4px dashed #FDD901;
}
a:link, .footernav.link, a.footernav:link, a.footernav:active {
/* edits all links */
color:#FDD901;
font:normal 12px arial;
line-height:12px;
text-decoration: none;
text-spacing:0px;
}
a:visited, a.footernav:visited, {
/* edits the links that the user has visited */
color:#FDD901;
font:12px arial;
line-height:12px;
text-decoration: line-through;
text-spacing:0px;
}
a:hover {
/* edits when user mouseovers the links */
font:12px arial;
font-weight:bold;
line-height:12px;
text-decoration: underline;
color:#FDD901
letter-spacing:1px;
}
input, select, textarea, iframe.htmleditor, .textfield, .button {
/* this edits the buttons, dropdowns, etc. */
border: 2px dashed #FDD901;
font:normal 12px arial;
background-color: transparent;
letter-spacing:0px;
color:#FFFFFF;
}
table.blogbody {
/* this edits the other the place where the blog is */
border: 2px dashed #FDD901;
border-top: 2px dashed #FDD901;
width: 280px;
background-color: transparent;
}
table.left {
/* this edits the menu module */
border: 2px dashed #FDD901;
width: 170px;
background-color: transparent;
text-align:center;
}
table.left th {
/* on your menu module, this edits the title part of it */
/* like BLOGRINGS, POSTING CALENDAR, etc */
background-color: transparent;
font: 12px arial;
line-height:12px;
text-transform:lowercase;
text-align:center;
font-color:#00B5E2;
border: 2px dashed #FDD901;
letter-spacing:2px;
}
table.left TD {
/* on your menu module, this edits the body part of it */
font:normal 12px arial;
color:#FFFFFF;
text-align:center;
LINE-HEIGHT:10PX;
border-top:2px dashed #FDD901;
width: 170px;
background-color: transparent;
}
table.search TD, table.search, table.announcements {
/* border of search bar (if you have it) */
background-color: transparent;
border: 2px dashed #FDD901;
}
table.search TD, table.announcements TH {
/* this should be left alone */
/* unless you know what to do */
border: 2px dashed #FDD901;
}
table.navigation, table.main, table.footer {
/* the width of your blog with modules */
width: 470px;
}
hr {
/* horizontal divider */
border:5px dashed #FDD901;
}
</style>
<!-- End Script by Mimz -->



<left><b><a href=http://www.xanga.com/Got_Layed>Wanna get layed?</a>

Other 使用AMR / 3GP进行ffmpeg编译(用于flash视频编码)

./configure --enable-mp3lame --enable-amr_nb --enable-amr_nb-fixed --enable-amr_wb --enable-a52 --enable-gpl --extra-cflags=-I/usr/local/include/ --extra-ldflags=-L/usr/local/lib/

CSS 中心内容

BODY { text-align: center; }
#centerItem { text-align: left; margin: auto; }