This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> | |
<script> | |
$(document).ready(function(){ | |
$("a").click(function(event){ | |
alert("As you can see, the link no longer took you to jquery.com"); | |
event.preventDefault(); | |
}); | |
}); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "observer" | |
class Tick | |
include Observable | |
def tick | |
loop do | |
now = Time.now | |
changed | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):023:0> "".respond_to? "=~" | |
=> true | |
irb(main):024:0> "".respond_to? "match" | |
=> true | |
irb(main):030:0> Regexp.compile("").respond_to? "match" | |
=> true | |
irb(main):032:0> Regexp.compile("").respond_to? "=~" | |
=> true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) throws IOException, ParseException { | |
String strDate = "2011-01-12 07:50:00"; | |
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
Date date = formatter.parse(strDate); | |
System.out.println("Date="+date); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void postSOAPXML(String soapBody) | |
{ | |
try { | |
// Get target URL | |
HttpClient httpclient = new DefaultHttpClient(); | |
StringEntity strEntity = new StringEntity(soapBody, "text/xml", "UTF-8"); | |
HttpPost post = new HttpPost(CAI3G_URL); | |
post.setHeader("SOAPAction","CAI3G#Create"); | |
post.setEntity(strEntity); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//获取douban.fm加红心的歌曲名+艺术家的jQuery脚本 | |
//http://douban.fm/mine?start=0&type=liked | |
$('p.song_title').map(function(){return ($(this).text()+"-"+$(this).next('p.performer').text())}) | |
result: | |
["踮起脚尖爱-洪佩瑜", "Innocent-久石譲", "晴朗-许巍", "时光-许巍", "Papa Was a Rodeo-Sara Lov", "Someone Like You-Adele", "一个像夏天一个像秋天-范玮琪", "風になる-サントラ", "遇见-孙燕姿", "左边-杨丞琳", "亲爱的你怎么不在身边-江美琪", "As Long As You Love Me-BACKSTREET BOYS", "爱情转移-陈奕迅", "情非得已-庾澄庆", "你要的爱-戴佩妮"] | |
Note: | |
可以将下面这行加成浏览器标签栏的bookmartlet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
font-family: Helvetica, arial, sans-serif; | |
font-size: 14px; | |
line-height: 1.6; | |
padding-top: 10px; | |
padding-bottom: 10px; | |
background-color: white; | |
padding: 30px; } | |
body > *:first-child { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# tomcat7 This shell script takes care of starting and stopping Tomcat | |
# | |
# chkconfig: - 80 20 | |
# | |
### BEGIN INIT INFO | |
# Provides: tomcat7 | |
# Required-Start: $network $syslog | |
# Required-Stop: $network $syslog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Init script contents: | |
#!/bin/bash | |
### BEGIN INIT INFO | |
# Provides: tomcat7 | |
# Required-Start: $network | |
# Required-Stop: $network | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 |
OlderNewer