CSS 固定页脚

#footer {
	position:fixed;
	left:0px;
	bottom:0px;
	height:30px;
	width:100%;
	background:#999;
}

/* IE 6 */
* html #footer {
	position:absolute;
	top:expression((0-(footer.offsetHeight)+(document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight)+(ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop))+'px');
}

Objective C 在GCD中使用dispatch_once

dispatch_queue_t get_my_background_queue()
{
	static dispatch_once_t once;
	static dispatch_queue_t my_queue;
	dispatch_once(&once, ^{
		my_queue = dispatch_queue_create("com.example.background", NULL);
	});
	return my_queue;
}

C# 如何以24小时格式转换时间?

DateTime d = DateTime.Now;

// 12 hour format
Response.Write(d.ToString("hh:mm") + " | " );

// 24 hour format
Response.Write(d.ToString("H:mm"));

JavaScript rgb2hex

function rgb2hex(rgb)
{
	rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
	function hex(x) {
		return ("0" + parseInt(x).toString(16)).slice(-2);
	}
	return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
}

HTML 简单的表格

<form class="contact-form" method="post" action="contact_fh.php">  
           <table align=center>
               <tr><td><label>Send to:</label></td>
                     <td><select name="sendto"> 
                           <option value="general">General Comments</option>
                           <option value="director">Director</option>
                           <option value="webmaster">Webmaster</option>                           
                         </select>
                      </td>
               </tr> 
               <tr><td><label><font color=red> *</font>Your Name:</label></td>
                  <td><input size=25 name="Name"></td>
               </tr> 
               <tr><td><label><font color=red> *</font>Your Email:</label></td>
                  <td><input size=25 name="Email"></td>
               </tr>  
               <tr><td style="vertical-align: top;"><label>Message:</label></td>
                  <td><textarea name="Message" rows=7 cols=35></textarea></td>
               </tr> 
               <tr><td colspan=2 align=center><input type=submit name="send" value="Contact NCCDC"></td>
               </tr>   
               <tr><td colspan=2 align=left><small><font color=red>*</font> Required</small></td></tr> 
           </table>
         </form>

PHP 将文件夹加载到PHP数组中

<?php 
$root = $_SERVER["DOCUMENT_ROOT"];
$path = "/NCCDC/test/docs"; 

$allowed = array('jpg','gif','png'); /* file extension that you want to keep */ 

$iterator = new DirectoryIterator($root.$path);
/* See php documentation on iterator */
foreach ($iterator as $fileinfo) {
    if ($fileinfo->isFile()) {
         $path = $fileinfo->getPathname();
         $filename = $fileinfo->getFilename(); /*filename like 'picture1.jpg' */
         $info = pathinfo($filename); 
         $ext =  $info['extension']; /* extension like 'jpg' */
         $filename_noext =  basename($filename,'.'.$ext);/*filename without extension like 'picture1' */
         /* Test to see if extension is allowed */
         if (in_array($ext, $allowed)){
            echo "<a href='$path'>$filename_noext</a><br/> \n";
         }
    }
}
?>

ActionScript 3 AS3布尔示例

//declare an int with a value of 5 and boolean
var five:int = 5;
var bool:Boolean;

if (five > 6)
{
	bool = true;
}
else
{
	bool = false;
}

//when comparing booleans, always make sure to 
//use two '=' signs, otherwise you'll set the 
//value of the variable to what you are trying
//to compare. This is called a logical operator.
if (bool == true)
{
	trace("This should actually be false. The value is 5, " +
		  "greater than 6.")
}
else
{
	trace("The value of the int is 5.");
}

PHP 如何使用PHP和pushme.to向iPhone发送推送通知

function pushMeTo($widgeturl,$text,$signature) {
	$agent = "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.12) Gecko/2009070611 Firefox/3.0.12";
	if (!function_exists("curl_init")) die("pushMeTo needs CURL module, please install CURL on your php.");
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $widgeturl);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_USERAGENT, $agent);
	$page = curl_exec($ch);
	preg_match("/form action=\"(.*?)\"/", $page, $form_action);
	preg_match("/textarea name=\"(.*?)\"/", $page, $message_field);
	preg_match("/input type=\"text\" name=\"(.*?)\"/", $page, $signature_field);
	$ch = curl_init();
	$strpost = $message_field[1].'=' . urlencode($text) . '&'.$signature_field[1].'=' . urlencode($signature);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $strpost );
	curl_setopt($ch, CURLOPT_URL, $form_action[1]);
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_USERAGENT, $agent);
	$page = curl_exec($ch);
}

PHP 获取文件扩展名

/**
*
* @Get File extension from file name
*
* @param string $filename the name of the file
*
* @return string
*
**/
function getFileExtension($filename){
  return substr($filename, strrpos($filename, '.'));
}

PHP 获取字符串的前两个单词

function first_two_words($val) {
	$val2 = substr($val, strpos($val, ' ')+1);
	$val = substr($val, 0, strlen($val)-strlen($val2)+strpos($val2, ' '));
	return $val;
}