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
<h1>{{ page.title }} <small>{{ page.tagline }}</small></h1> |
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
<h1>{{ page.title }} {% if page.tagline %} <small>{{ page.tagline }}</small>{% endif %}</h1> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>利用haslayout</title> | |
<style type="text/css"> | |
#left | |
{float:left;width:100px;height:100px;background-color:#ccc;border:2px solid #333; | |
} | |
#right | |
{overflow:hidden;zoom:1; border:2px solid #333;background:#ccc url(http://www.baidu.com/img/baidu_logo.gif) no-repeat; |
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
using System.Drawing; | |
using System.Drawing.Drawing2D; | |
public void ResizeStream(int imageSize, Stream filePath, string outputPath) | |
{ | |
var image = Image.FromStream(filePath); | |
int thumbnailSize = imageSize; | |
int newWidth, newHeight; |
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
只有 IE 和 Opera 的 HTMLDOMNode 有 removeNode 方法,其他浏览器则不支持。 | |
解决方法: | |
if(window.Node&&!window.opera){ | |
Node.prototype.removeNode=function(removeChildren){ | |
if(removeChildren||!this.hasChildNodes()){ | |
return this.parentNode.removeChild(this); | |
} | |
var $parent=this.parentNode; |
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
大部分的字符串替换都是用正则的, 如果需要类似C#的replace那样的功能, 直接用sub(). | |
"foo,bar,baz".sub("foo","boo") | |
=> "boo,bar,baz" |
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
在IE8和Chrome下, 都有insertAdjacentElement这个方法, 但是FF中不支持。 | |
var newElem = document.createElement("span"); | |
newElem.innerHTML = 'this is a new element here'; | |
existingElement.insertAdjacentElement("AfterEnd", newElem); | |
实现方式有2种: | |
1. 用其他方法代替(经测试, 下述代码兼容IE7,8/FF/Chrome/Safari) | |
if(existingElement.nextSibling) | |
{newElem.parentNode.insertBefore(newElem, existingElement.nextSibling);} |
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
1. 56.com网站 | |
url类型: | |
http://www.56.com/w54/album-aid-7657069.html | |
http://www.56.com/w88/album-aid-7609666.html | |
http://www.56.com/u82/v_NTczMjc3NTk.html | |
http://www.56.com/w43/play_album-aid-7705385_vid-NDYwNjA4MTg.html | |
http://player.56.com/v_54644709.swf | |
对应的json请求: |
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
#Persistent #NoEnv | |
v_Enable=0 $F12:: { Winget, wowid, list, 魔兽世界 WinSetTitle, ahk_id%wowid1%, , 魔兽世界1# WinSetTitle, ahk_id%wowid2%, , 魔兽世界2# v_Enable:=!v_Enable If (v_Enable=0) SetTimer, Label0, Off Else SetTimer, Label0, 1 } Return | |
Label0: { | |
ControlSend,, {F11}, ahk_id %wowid1% sleep, 200 ControlSend,, {F11}, ahk_id %wowid2% sleep, 200 } Return |
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
用instanceof来判断是否是指定的控件类型 | |
TableLayout myLayOut = (TableLayout)findViewById(R.id.tableLayout1); | |
for (int i = 0; i < myLayOut.getChildCount(); i++) { | |
View v = myLayOut.getChildAt(i); | |
if ( v instanceof ImageView){ | |
ImageView myImageView = (ImageView)myLayOut.getChildAt(i); | |
myImageView.setOnClickListener(new myOnclickListener()); | |
} | |
} |
OlderNewer