Other EXTJS - 来自远程文件的网格,其中包含用于dbl click的侦听器

/**
 * grid from remote file with a listener for dbl click
 */

HO.Class.CRUD.prototype.defineGrid = function () {	
	console.log('HO.Class.CRUD.initGrid ');
	
	this.Grid = new Ext.ux.Plugin.RemoteComponent({
				url : '/files/ux/RemoteComponent/implementation4/grid_generated.php'
				//,loadOn : 'show'  /* defer processing to container's show-event */
			});
	
	// add events
	this.Grid.on('success', function(cmp){
		cmp.on('rowdblclick', this.onRowDblClick);
	    return false;
	}, this);
}

Other EXTJS - 仅在新选项卡不存在时创建

/**	
 * 	Create new tab only if it does not exist before
 */

// Show tab way
HO.Class.CRUD.prototype.showTab = function (id,name) {

	HO.log("HO.Class.CRUD.showTab " + id + " " + name);

	var tabID = this.ComponentName + id;
	var tab = this.TabPanel.items.find(function(i){
		return i.id === tabID;
	})
	if (!tab) { 
		 showObject = 	this.getShowObject(id,tabID, name);

		this.TabPanel.add( showObject ).show();
		// x = {title: "dupa", layout: 'fit', items: [showObject]
		// ,autoScroll		: 	true
		// ,bodyStyle		: 	'position:relative'
		// 
		// }
		// 	
		// this.TabPanel.add( x ).show();


	} else {
		HO.log('tab exists');
		this.TabPanel.setActiveTab(tabID);
	}
}
//	eo function showTab
	

Other DOCTYPE XHTML STRICT 1.0

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Other 外部.css样式表链接

		<link rel="stylesheet" type="text/css" href="style.css" />

Other 卷曲示例

Curl Examples
#  with basic auth
curl -v -X GET --basic -u username:password "http://www.domainname.com"

# with cookie support
# -b and -c allow cookies to be written to a file and then presented on next request
# -L allows for following, ie if a 302 is sent, this makes another request to address in the redirect
curl -v -X GET --basic -u username:password "http://www.domainname.com" -b cookies.txt -c cookies.txt -L

Other 淘气算法

# loop through all of humanity
humanity.each do |human|
	
	# select out a set of presents for this human
	presents = santas_bag.select do |gift|
		good_enough = list.is_good_enough_for_this_gift?(human, gift)
		if (!good_enough) # better check twice
			good_enough = list.is_good_enough_for_this_gift?(human, gift)
		return good_enough
	end

	santa.leave presents
end

Other 如何将mysql.sock链接到MAMP的mysql sock

sudo ln -s /Applications/MAMP/mysql/mysql.sock /var/mysql/mysql.sock

Other onclick标题wordpress javascript

	<div id="header" onclick="location.href='http://stavelin.com/blog/';" style="cursor: pointer;">

Other 在Vim中搜索和替换

:%s/searchterm/replaceterm/g

eg.

Search for the word "today" within the whole file and replace all occurrences of it with "tomorrow".

:%s/today/tomorrow/g

Other 在OSX 10.5上更新Rails

sudo gem update --system�
sudo gem install rails�
sudo gem update sqlite3-ruby