HTML 无障碍表

				<table class="creditHistory">
					<thead>
						<tr>
							<td> </td>
							<th id="method-1" axis="method" scope="col">In</th>
							<th id="method-2" axis="method" scope="col">Out</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<th id="date-1" axis="date" scope="row">19 September 2007</th>
							<td headers="date-1 method-1"><strong>10</strong> added</td>
							<td headers="date-1 method-2"> </td>
						</tr>
						<tr>
							<th id="date-2" axis="date" scope="row">9 September 2007</th>
							<td headers="date-2 method-1"> </td>
							<td headers="date-2 method-2"><strong>10</strong> used</td>
						</tr>
						<tr>
							<th id="date-3" axis="date" scope="row">18 August 2007</th>
							<td headers="date-3 method-1"><strong>50</strong> added</td>
							<td headers="date-3 method-2"> </td>
						</tr>
						<tr>
							<th id="date-4" axis="date" scope="row">8 August 2007</th>
							<td headers="date-4 method-1"> </td>
							<td headers="date-4 method-2"><strong>4</strong> to <a href="full-friends-hubbub.php">dicky</a></td>
						</tr>
						<tr>
							<th id="date-5" axis="date" scope="row">17 july 2007</th>
							<td headers="date-5 method-1"> </td>
							<td headers="date-5 method-2"><strong>4</strong> used</td>
						</tr>
						<tr>
							<th id="date-6" axis="date" scope="row">7 June 2007</th>
							<td headers="date-6 method-1"> </td>
							<td headers="date-6 method-2"><strong>1</strong> used</td>
						</tr>
						<tr>
							<th id="date-7" axis="date" scope="row">16 June 2007</th>
							<td headers="date-7 method-1"><strong>10</strong> from <a href="full-friends-hubbub.php">dicky</a></td>
							<td headers="date-7 method-2"> </td>
						</tr>
					</tbody>
				</table>

C# 按URL的ASP XML Web控件内容

//script
XmlDocument xdocUrl = new XmlDocument();
//Read URL into new XmlDocument
xdocUrl.Load("http://www.domain.com/content.xml");
xmlCtrl.DocumentContent = xdocUrl.InnerXml;
//Load XSLT for formating
xmlCtrl.TransformSource = "~/template.xslt";

//page tag
<asp:Xml ID="xmlCtrl"  runat="server"></asp:Xml>

PHP 编程说明

<?php

// TODO:		Enter some task that needs to be done.
// FIXME:		Enter some bug that needs to be fixed.
// FIXME(BugNumber):	Reference a bug number for FIXME.
// CHANGED:		Once finished with TODO, replacement with CHANGED is recommended.
// NOTE:		Enter a simple note.
// OPTIMIZE:		A TODO specifically for optimization notes.
// IMPROVE:		A TODO specifically for improvement notes.

// Examples:

// TODO: Add in a update script.
// FIXME: Bug in update script (cannot download new file).
// FIXME(81239): Bug in update script (cannot download new file).
// CHANGED: Added update script.
// NOTE: The update script is still a bit buggy.
// OPTIMIZE: Update download speed.
// IMPROVE: Make the UI a bit better for update script.

?>

Bash 将行附加到文件

echo "<string to append>" >> <file>

#Example:

echo "My string" >> /home/user/myfile.txt

JavaScript ext js BorderLayout

<div id="pageContainer" class="pageContainer"></div>
<div id="west">
	<p>Hi. I'm the west panel.</p>
</div>
<div id="north">
	<p>Hi. I'm the north panel.</p>
</div>
<div id="center">
	<p>Hi. I'm the center panel.</p>
</div>

Ext.onReady(
	borderLayout
);


function borderLayout(){
	var center = new Ext.Panel({
        items: [{
            contentEl: 'center',
            autoScroll: true,
            border: false
        }]
	});

	var border = new Ext.Panel({
	    title: 'Border Layout',
	    height: 500,
	    layout: 'border',
	    items: [{
	        title: 'North Panel',
	        region: 'north',
	        height: 100,
	        minSize: 75,
	        maxSize: 250,
	        margins: '5 5 5 5',
	        border: false,
	        items: [{
	            contentEl: 'north',
	            autoScroll: true,
	            border: false
	        }]
	    },{
	        title: 'South Panel',
	        region: 'south',
	        height: 100,
	        minSize: 75,
	        maxSize: 250,
	        margins: '5 5 5 5'
	    },{
	        title: 'East Panel',
	        region: 'east',
	        margins: '0 5 0 0',
	        width: 200,
	        minSize: 100,
	        maxSize: 300
	    },{
	        title: 'West Panel',
	        region:'west',
	        margins: '0 0 0 5',
	        width: 200,
	        minSize: 100,
	        maxSize: 300,
	        items: [{
	            contentEl: 'west',
	            autoScroll: true,
	            border: false
	        }]
	    },{
	        title: 'Main Content',
	        region: 'center',
	        margins: '0 0 0 0',
	        items: [center]
	    }]
	});
	
	border.render('pageContainer');
}

JavaScript 用字符集翻转文本

function flip() {
 var result = flipString(document.f.original.value.toLowerCase());
 document.f.flipped.value = result;
}

function flipString(aString) {
 var last = aString.length - 1;
 //Thanks to Brook Monroe for the
 //suggestion to use Array.join
 var result = new Array(aString.length)
 for (var i = last; i >= 0; --i) {
  var c = aString.charAt(i)
  var r = flipTable[c]
  result[last - i] = r != undefined ? r : c
 }
 return result.join('')
}

var flipTable = {
a : '\u0250',
b : 'q',
c : '\u0254', //open o -- from pne
d : 'p',
e : '\u01DD',
f : '\u025F', //from pne
g : '\u0183',
h : '\u0265',
i : '\u0131', //from pne
j : '\u027E',
k : '\u029E',
//l : '\u0283',
m : '\u026F',
n : 'u',
r : '\u0279',
t : '\u0287',
v : '\u028C',
w : '\u028D',
y : '\u028E',
'.' : '\u02D9',
'[' : ']',
'(' : ')',
'{' : '}',
'?' : '\u00BF', //from pne
'!' : '\u00A1',
"\'" : ',',
'<' : '>',
'_' : '\u203E',
';' : '\u061B',
'\u203F' : '\u2040',
'\u2045' : '\u2046',
'\u2234' : '\u2235'
}

for (i in flipTable) {
  flipTable[flipTable[i]] = i
}

Ruby 基准对象#ergo

require 'benchmark'

# The original implementation by Daniel DeLorme
# http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/256662

class NilClass
   def ergo
     @blackhole ||= Object.new.instance_eval do
       class << self
         for m in public_instance_methods
           undef_method(m.to_sym) unless m =~ /^__.*__$/
         end
       end
       def method_missing(*args); nil; end
       self
     end
     @blackhole unless block_given?
   end
end

class Object
   def ergo
     if block_given?
       yield(self)
     else
       self
     end
   end
end

a,b = [1,2,3], nil
n = 100_000

Benchmark.bm(15) do |x|
  x.report("Original") do
    n.times { a.ergo[0];   b.ergo[0] }
  end

  # Turn to facets implementation
  require 'rubygems'
  require 'facets/nilclass/ergo'

  x.report("Facets") do 
    n.times { a.ergo[0];   b.ergo[0] }
  end

  x.report("Logic operators") do
    n.times { a && a[0];  b && b[0] }
  end
end

Rails Rails Enkoder

<%=
  enkode_mail(
    'someone@example.com',
    'Link text',
    'Link title',
    'Subject line'
  )
%>

PHP 动态指数

// home.php?act=index

<?php

if (isset($_GET['act'])) $PAGEACTION = $_GET['act'];

else $PAGEACTION = 'index';

switch ($PAGEACTION) {

// index page
case 'index':
include ('index.php');
break;

// an about page
case 'about':
include ('about.php');
break;

// $PAGEACTION doesn't exist
default:
// or just forward to home.php?act=index
echo "page does not exist";
break;
}

?>

JavaScript Javascript关闭

/*
 * Since we are passing the inner function outside, a reference to it
 * still exists, hence it is not collected by the garbage collector.
 * 
 * The variable a persists through to the next increment, and is not overwritten
 * by outer() var a = 0 since inner still has a local variable inside it's scope.
 * 
 * By creating global2, you have created another scope that acts independently,
 * even though they are using the same function literal! 
 */
function outer(){//define outer scope
	var a = 0;//this is the persistent variable
	function inner(){//define the inner scope
		a++;//increment a
		console.log(a);
	}
	return inner;//IMPORTANT: return the inner function to the outside (scope)
}
var global = outer();//create a new scope in global
global();//a = 1
global();//a = 2
var global2 = outer();
global2();//a = 1
global2();//a = 2