This file contains hidden or 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
function selectText(textbox, startIndex, stopIndex) { | |
if (textbox.setSelectionRange) { | |
textbox.setSelectionRange(startIndex, stopIndex); | |
} else if (textbox.createTextRange) { | |
var range = textbox.createTextRange(); | |
range.collapse(true); | |
range.moveStart("character", startIndex); | |
range.moveEnd("character", stopIndex - startIndex); | |
range.select(); | |
} |
This file contains hidden or 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
var toType = function(obj) { | |
return Object.prototype.toString.call(o).match(/\s([a-zA-Z]+)/)[1].toLowerCase(); | |
} |
This file contains hidden or 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
// forEach | |
if (typeof Array.prototype.forEach != "function") { | |
Array.prototype.forEach = function (fn, context) { | |
for (var k = 0, length = this.length; k < length; k++) { | |
if (typeof fn === "function") { | |
fn.call(context, this[k], k, this); | |
} | |
} | |
}; |
This file contains hidden or 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
<?php | |
error_reporting( E_ALL ); | |
// 测试 | |
imagezoom('1.jpg', '2.jpg', 400, 300, '#FFFFFF'); | |
/* | |
php缩略图函数: | |
等比例无损压缩,可填充补充色 author: 华仔 | |
主持格式: |
This file contains hidden or 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
<?php | |
$url='http://twitter.com/statuses/user_timeline/16387631.json'; //rss link for the twitter timeline | |
print_r(get_data($url)); //dumps the content, you can manipulate as you wish to | |
/* gets the data from a URL */ | |
function get_data($url) | |
{ | |
$ch = curl_init(); | |
$timeout = 5; |
This file contains hidden or 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
<?php | |
header("Expires: Tue, 01 Jul 2001 06:00:00 GMT"); | |
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); | |
header("Cache-Control: no-store, no-cache, must-revalidate"); | |
header("Cache-Control: post-check=0, pre-check=0", false); | |
header("Pragma: no-cache"); | |
?> |
This file contains hidden or 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
function get_clientip(){ | |
if(isset($_SERVER)){ | |
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])){ | |
$realip = $_SERVER['HTTP_X_FORWARDED_FOR']; | |
}elseif (isset($_SERVER['HTTP_CLIENT_IP'])){ | |
$realip = $_SERVER['HTTP_CLIENT_IP']; | |
}else{ | |
$realip = $_SERVER['REMOTE_ADDR']; | |
} | |
}else{ |
This file contains hidden or 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
/** | |
* Returns the contents of a web page | |
* | |
* Opens a remote web document, and returns the contents. This method | |
* uses sockets to get the document. Returns the contents of the document with | |
* the headers being stored in the $headers variable. | |
* This method can handle 301 and 302 redirects, but will return false | |
* if anything other than those status codes, or a 200, is returned by | |
* the web server. | |
* |
This file contains hidden or 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
selector { | |
opacity: .75; /* Standard: FF gt 1.5, Opera, Safari */ | |
filter: alpha(opacity=75); /* IE lt 8 */ | |
-ms-filter: "alpha(opacity=75)"; /* IE 8 */ | |
-khtml-opacity: .75; /* Safari 1.x */ | |
-moz-opacity: .75; /* FF lt 1.5, Netscape */ | |
} |