文章列表
ready(fn)
$(document).ready(function(){
// Your code here...
});
作用:它可以极大地提高web应用程序的响应速度。通过使用这个方法,可以在DOM载入就绪能够读取并操纵时立即调用你所绑定的函数,而99.99%的JavaScript函数都需要在那一刻执行。
bind(type,[data],fn)
$("p").bind("click", function(){
alert( $(this).text() );
});
作用:为每一个匹配元素的特定事件(像cl ...
if($.trim($("#phone").val())=="")
{
alert("手机号码不能为空!");
return false;
}
if($.trim($("#phone").val())!="")
{
var reg = /^(130|131|132|133|134|135|136|137|138|139|150|153|157|158|159| ...
清单3
module Dictionary
class Word
attr_reader :spelling, :part_of_speech, :definitions, :synonyms
attr_writer :spelling, :part_of_speech
def initialize(spelling, part_of_speech, definitions = [], synonyms = [])
@spelling = spelling
@part_of_speech = pa ...
1、将文件checkout到本地目录
svn checkout path(path是服务器上的目录)
例如:svn checkout svn://192.168.1.1/pro/domain
简写:svn co
2、往版本库中添加新的文件
svn add file
例如:svn add test.php(添加test.php)
svn add *.php(添加当前目录下所有的php文件)
3、将改动的文件提交到版本库
svn commit -m "LogMessage" [-N] [--no-unlock] PATH(如果选择了保持锁,就使用--n ...
http://gist.github.com/609762
#!/bin/sh
svn remove log/*
svn commit -m”removing log files”
svn propset svn:ignore “*.log” log/
svn update log/
svn commit -m ‘Ignoring all files in /log/ ending in .log’
svn move config/database.yml config/database.example
svn commit -m ‘Moving database.yml ...
每种语言都有它特别的地方,对于JavaScript来说,使用var就可以声明任意类型的变量,这门脚本语言看起来很简单,然而想要写出优雅的代码却是需要不断积累经验的。本文利列举了JavaScript初学者应该注意的七个细节,与大家分 ...
根据字符串匹配来查看文件部分内容
find . -name .svn | xargs rm -rf`
grep 字符串 文件名
显示包含或者不包含字符串的文件名
grep -l -r 字符串 路径 #显示内容包含字符串的文件名
grep -L -r 字符串 路径 #显示内容不包含字符 ...
Android have lots of intent,it’s powerful and useful,here is some tips for you:
1,start web browser
Uri myBlogUri = Uri.parse("http://kuikui.iteye.com");
returnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);
2,Google map
Uri mapUri = Uri.parse("geo:38.899533,-77.036476" ...
config.plugins = [ :all ]
config.plugins -= [ "paperclip-win" ]
对于多数的model的select列表,我都会用model属性+方法的形式,做一个列表,然后在form里显示。
def self.purchase_status
{0 =>'状态0',1=>'状态1',2=>'状态2'}
end
form里调用
<%= f.select :purchase_status ,Model.purchase_status.invert%>
list里面展示
def purchase_status_view
Model.purchase_status[self.purchase_ ...
自定义form错误提示
application_controller.rb中添加:
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
case html_tag
when /<(label)/
%(<div class="error">#{html_tag}</div>).html_safe
when /<(input|textarea|select)/
if instance.error_message.ki ...
http://github.com/thedarkone/rails-dev-boost/tree/master
script/plugin install git://github.com/thedarkone/rails-dev-boost -r rails-2-3
首先在database.yml中加入以下代码,其中cg_clone是外部等待使用的数据库。
cg_clone:
adapter: mysql
database: cg_clone
username: root
password:
host: localhost
假如在cg_clone中有一张表叫contracts,那么生成Contract类。并用establish_connection来声明建立到哪个数据库的连接:
class Contract < ActiveRecord::Base
establish_connection :cg_clone
end
...
time_now = Time.now
当前时间的后一天
(Date.parse(time.to_s)+1.day).to_s(:date)
当前时间的前一天
(Date.parse(time.to_s)-1.day).to_s(:date)
/bin
bin是binary的缩写。这个目录沿袭了UNIX系统的结构,存放着使用者最经常使用的命令。例如cp、ls、cat,等等。
/boot
这里存放的是启动Linux时使用的一些核心文件。
/dev
dev是device(设备)的缩写。这个目录下是所有Linux的外部 ...