Bash 将文件重命名为小写

rename 'y/A-Z/a-z/' *
find ./ -type f -exec rename 'y/A-Z/a-z/' {} \;

ActionScript 3 最基本皓flvæ'放器

var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);

var vid:Video = new Video(320, 240);
this.addChild(vid);

vid.attachNetStream(ns);

ns.play("http://www.linkmobile.net/yf/Wanted_T4.flv");

ns.addEventListener(NetStatusEvent.NET_STATUS, netstat);

function netstat(stats:NetStatusEvent)
{
        //trace(stats.info.code);
}

var netClient:Object = new Object();
netClient.onMetaData = function(meta:Object)
{
        trace(meta.width);
};

ns.client = netClient;

JavaScript Jquery Hover(HoverIntent)

$(document).ready(function() {
	$('.ticker-prev, .ticker-next').hide();
	$('#topbar').hoverIntent(function() {
		$('.ticker-prev, .ticker-next').fadeIn(500);
	},
	function() {
		$('.ticker-prev, .ticker-next').fadeOut(500);
	});
});

SQL MySQL转储

Export
$ mysqldump -u username -p -h mysqlhostname databasename > databasedump.sql

Import
$ mysql -u username -p -h mysqlhostname databasename < databasedump.sql

PHP 打印所有POST变量

<?php 
print_r($HTTP_POST_VARS);
?>

JavaScript DOM Scripting vs jQuery 2:Acceso是一个元素和事件

/*DOM Scripting*/
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function mostrarMensaje(){
  if (!document.getElementsByTagName) return false;
  var links = document.getElementsByTagName('a');
  for (var i=0;i<links.length;i++) {
    links[i].onclick = function() {
      alert('Presionastes un elemento <a>');
	}
  }  
}

addLoadEvent(mostrarMensaje);


/*jQuery*/
$(document).ready(function(){
    //Aqui asignamos el click al elemento <a>	
	$('a').click(function(){
		alert('Presionastes un elemento <a>');
	});
});

JavaScript Extjs面板拖放

Ext.namespace('Ext.test');

Ext.test.Panel = function() {

	this.left = new Ext.Panel({
				id : 'left',
				border : true,
				bodyStyle : 'padding: 5px',
				defaults : {
					style : 'margin-bottom: 5px',
					draggable : {
						insertProxy : false,
						onDrag : function(e) {
							var pel = this.proxy.getEl();
							this.x = pel.getLeft(true);
							this.y = pel.getTop(true);

							var s = this.panel.getEl().shadow;
							if (s) {
								s.realign(this.x, this.y, pel.getWidth(), pel
												.getHeight());
							}
						},
						endDrag : function(e) {
							this.panel.setPosition(this.x, this.y);
						}
					}
				},
				items : [{
							id : 'panel1',
							html : 'Panel 1'
						}, {
							id : 'panel2',
							html : 'Panel 2'
						}, {
							id : 'panel3',
							html : 'Panel 3'
						}, {
							id : 'panel4',
							html : 'Panel 4'
						}, {
							id : 'panel5',
							html : 'Panel 5'
						}]
			});

	this.right = new Ext.Panel({
				border : true,
				id : 'right',
				bodyStyle : 'padding: 5px',
				defaults : {
					bodyStyle : 'padding-left: 5px'
				}
			});

	this.right.on('render', this.onRightRender, this);

	Ext.test.Panel.superclass.constructor.call(this, {
				renderTo : 'pageContainer',
				bodyStyle : 'padding: 5px',
				height : 500,
				width : 760,
				title : 'Demo',
				layout : 'table',
				defaults : {
					height : 200,
					width : 200
				},
				items : [this.left, this.right]
			});
};

Ext.extend(Ext.test.Panel, Ext.Panel, {
			onRightRender : function(cmp) {
				var sourcePanelDropTarget = new Ext.dd.DropTarget(cmp.body.dom,
						{
							notifyDrop : function(ddSource, e, data) {
								cmp.add(ddSource.panel);
								cmp.doLayout();
								return (true);
							}
						});
			}
		});

Ext.onReady(function() {
			Ext.QuickTips.init();
			var panel = new Ext.test.Panel();
		});

JavaScript Fadint链接到另一种颜色

/* plugin */
jQuery.fn.dwFadingLinks = function(settings) {
	settings = jQuery.extend({
		color: '#ff8c00',
		duration: 500
	}, settings);
	return this.each(function() {
		var original = $(this).css('color');
		$(this).mouseover(function() { $(this).animate({ color: settings.color },settings.duration); });
		$(this).mouseout(function() { $(this).animate({ color: original },settings.duration); });
	});
};

/* usage */
$(document).ready(function() {
	$('.fade').dwFadingLinks({
		color: '#008000',
		duration: 700
	});
});

Rails 002_add_price.rb

class AddPrice < ActiveRecord::Migration
  def self.up
	  add_column :products, :price, :decimal, :precision => 8, :scale =>2, :default => 0
  end

  def self.down
	  remove_column :products, :price
  end
end

ActionScript 3 定义存在冲突

//