PHP codeigniter - JSON标头

$this->output->set_status_header(200);
    $this->output->set_header('Content-type: application/json');

C# 日期时间差2

class DateTimeDiff
	{
		
		/// <summary>
		///		Difference btweeen dates expressed in years, months and days.
		/// </summary>
		/// <param name="dtStartDate"></param>
		/// <param name="dtEndDate"></param>
		/// <param name="YearsDiff"></param>
		/// <param name="MonthsDiff"></param>
		/// <param name="DaysDiff"></param>
		public static void TimeSpanToDate(
			DateTime dtStartDate, 
			DateTime dtEndDate, 
			out Int32 YearsDiff, 
			out Int32 MonthsDiff, 
			out Int32 DaysDiff
			)
		{
			bool bRegularOrder = true;  // is the start date before end date
			
			if (dtEndDate < dtStartDate) { 
				// if the order of dates is reversed, dates are reversed, then difference is computed
				// however, we remember that order is reversed, so at the end we put minus before all results componenet
				DateTime d3 = dtStartDate;
				dtStartDate = dtEndDate;
				dtEndDate = d3;
				bRegularOrder = false;
			}

			// compute difference in total months
			MonthsDiff = 12 * (dtEndDate.Year - dtStartDate.Year) + (dtEndDate.Month - dtStartDate.Month);

			// based upon the days
			// adjust months & compute actual days difference  
			if (dtEndDate.Day < dtStartDate.Day) {
				// check if both dates are the last day in the month
				if (dtStartDate.Day == DateTime.DaysInMonth(dtStartDate.Year, dtStartDate.Month)
						&& dtEndDate.Day == DateTime.DaysInMonth(dtEndDate.Year, dtEndDate.Month)) {
					DaysDiff = 0; // whereas month number remains unchanged
				}
				else {			
					MonthsDiff--;
					Int32 iBrojDanaPrethodnogMesecaZavrsnogDatuma = DayInMonthOfPreviousMonth(dtEndDate);
					DaysDiff = Math.Max(0, iBrojDanaPrethodnogMesecaZavrsnogDatuma - dtStartDate.Day) 
							+ dtEndDate.Day;
				}
			}
			else {
				DaysDiff = dtEndDate.Day - dtStartDate.Day;
			}
			// compute YearsDiff & actual MonthsDiff  
			YearsDiff = MonthsDiff / 12;
			MonthsDiff -= YearsDiff * 12;

			// if the order was reversed, put minus sign before all componenet results
			if (!bRegularOrder) {
				YearsDiff = -YearsDiff;
				MonthsDiff = -MonthsDiff;
				DaysDiff = -DaysDiff;
			}
		}
		
		private static Int32 DayInMonthOfPreviousMonth(DateTime dt)
		{
			Int32 month = dt.Month;
			Int32 year = dt.Year;
			
			// previous month
			month--;
			if (month == 0) {
				month = 12;
				year--;
			}
			return DateTime.DaysInMonth(year, month);
		}
		
		
	
	}

CSS css3不透明度

background-color: rgba(0,0,0,0.2);

CSS CSS3 - Fancy Nice酷Web2.0 ZURB超级棒的CSS3和RGBA按钮

/* @group ZURB Awesome Buttons */

/*
 * 201008201230 - brandonjp 
 *
 * Adapted from	http://bit.ly/zurb-buttons
 * Demo at http://bit.ly/zurb-buttons-demo
 *
 * USAGE: Give your element class "button" or use the HTML5 <button>
 *
 */

.button, .button:visited, button, button:visited {
	cursor: pointer;
	position: relative;
	display: inline-block;
	padding: 5px 10px 6px;
	
	color: #fff;
	line-height: 1;
	font-weight: bold;
	text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
	text-decoration: none;
	
	background: #222 url(images/alert-overlay.png) repeat-x;
	border-bottom: 1px solid rgba(0,0,0,0.25);
	
	border-radius: 5px;
	-khtml-border-radius: 5px;
	-moz-border-radius: 5px;
	-webkit-border-radius: 5px;
	
	box-shadow: 0 1px 3px rgba(0,0,0,0.5);
	-khtml-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
	-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
	-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.button:hover, button:hover {
	background-color: #111;
	color: #fff;
}

.button:active, button:active {
	top: 1px;
}

.small.button, .small.button:visited,
button.small, button.small:visited {
	font-size: 11px;
}

.button, .button:visited, button, button:visited,
.medium.button, .medium.button:visited,
button.medium, button.medium:visited {
	font-size: 13px;
}

.large.button, .large.button:visited,
button.large, button.large:visited {
	font-size: 14px;
	padding: 8px 14px 9px;
}

.green.button, .green.button:visited,
button.green, button.green:visited {
	background-color: #91bd09;
}

.green.button:hover,
button.green:hover {
	background-color: #749a02;
}

.blue.button, .blue.button:visited,
button.blue, button.blue:visited {
	background-color: #2daebf;
}

.blue.button:hover,
button.blue:hover {
	background-color: #007d9a;
}

.red.button, .red.button:visited,
button.red, button.red:visited {
	background-color: #e33100;
}

.red.button:hover,
button.red:hover {
	background-color: #872300;
}

.magenta.button, .magenta.button:visited,
button.magenta, button.magenta:visited {
	background-color: #a9014b;
}

.magenta.button:hover,
button.magenta:hover {
	background-color: #630030;
}

.orange.button, .orange.button:visited,
button.orange, button.orange:visited {
	background-color: #ff5c00;
}

.orange.button:hover,
button.orange:hover {
	background-color: #d45500;
}

.yellow.button, .yellow.button:visited,
button.yellow, button.yellow:visited {
	background-color: #ffb515;
}

.yellow.button:hover,
button.yellow:hover {
	background-color: #fc9200;
}


/* @end ZURB Awesome Buttons */

ActionScript 3 RGB颜色通道/分离和组合

To seprate the color channels:

    * R = 0xFC3343  >>  16

    * G = (0xFC3343 >> 8 )  &  0xFF

    * B = 0xFC3343  &  0xFF

To combine them:

    * RGB =  (0xFC <<  16) + (0×33  <<  8 )  + 0×43

Apache HTACCESS - 将辅助域重定向到主域

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^secondarydomain1.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.secondarydomain1.com$
RewriteRule (.*)$ http://www.primarydomain.com/$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^secondarydomain2.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.secondarydomain2.com$
RewriteRule (.*)$ http://www.primarydomain.com/$1 [R=301,L]

C# C#:调用其他构造函数

class foo
{
    public foo(){}
    public foo(string s ) { }
    public foo (string s1, string s2) : this(s1) {....}

}

Bash progress_bar.sh

#  snippet:   progress_bar.sh
#  version:   0.02
#  author:    ksaver (at identi.ca)
#  license:   http://creativecommons.org/licenses/BSD/
#  sets:      progress_bar function
#  arguments: progress_bar function: optional arguments "Text" and width.
#             "Text": Any informative text string.
#             Width:  An integer number, is the max width for the progress bar.
#  usage:     Use into a script:
#             source progress_bar.sh
#             a) progress_bar "Counting:" 25 <<< $PERCENT
#             b) for i in {1..100}; do echo $i; sleep 1; done |progress_bar "" 20
#  output:    Counting: [ ============> ] 50%          

function progress_bar()
{
    while read PERCENT
    do
        COUNT=0
        FOO='>'
        BAR=''
        CHAR='='                 # Change by "#", "|" or any character.
        TEXT=${1:-"Progress:"}   # Sets default value to var $TEXT
        WIDTH=${2:-40}           # Sets default value to var $WIDTH
        
        PROGRESS=$(($PERCENT*$WIDTH/100))
        
        while [ $COUNT -lt $(($PROGRESS+1)) ]
        do  
            printf "\r\t$TEXT [ %s%s ] $PERCENT%% " ${BAR} ${FOO}
            
            BAR="${BAR}$CHAR"
            COUNT=$(($COUNT+1))
        done
    done
    echo " Done."
}

PHP Wordpress管理页脚

add_filter('admin_footer_text', 'remove_footer_admin'); //change admin footer text
function remove_footer_admin () {
echo "Custom Text or leave empty";
}

ActionScript 3 AS3加载外部文本文件

package
{
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.events.IOErrorEvent;
	import flash.net.URLLoader;
	import flash.net.URLRequest;

	public class Main extends MovieClip
	{
		private var _txtFileToLoad:String = "myTextFile.txt";
		private var _txtLoader:URLLoader;
		private var _loadedTxt:String;
		

		public function Main():void
		{
			loadExternalTxtFile();
		}
		
		private function loadExternalTxtFile():void
		{
			_txtLoader = new URLLoader();
			_txtLoader.addEventListener(Event.COMPLETE, onTxtLoader_COMPLETE);
			_txtLoader.addEventListener(IOErrorEvent.IO_ERROR, onTxtLoader_IO_ERROR);
			_txtLoader.load(new URLRequest(_txtFileToLoad));
		}
		
		private function onTxtLoader_COMPLETE(event:Event):void {
			_txtLoader.removeEventListener(Event.COMPLETE, onTxtLoader_COMPLETE);
			_txtLoader.removeEventListener(IOErrorEvent.IO_ERROR, onTxtLoader_IO_ERROR);
			_loadedTxt = String(event.target.data);
			trace(_loadedTxt);
		}
		
		private function onTxtLoader_IO_ERROR(event:Event):void {
			_txtLoader.removeEventListener(Event.COMPLETE, onTxtLoader_COMPLETE);
			_txtLoader.removeEventListener(IOErrorEvent.IO_ERROR, onTxtLoader_IO_ERROR);
			trace(event.target.text);
		}

	}
}