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
function get_uri_params( $default = 'page', $uri = array() ) | |
{ | |
$uri = empty($uri) ? $_GET : $uri; | |
if (is_array($default)) { | |
foreach ($default as $value) { | |
unset( $uri[$value] ); | |
} | |
} else { | |
unset( $uri[$default] ); | |
} |
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
<?php | |
/* | |
$params['total_rows'] = 100; | |
$params['page'] = isset($_GET['page']) ? $_GET['page'] : 1; | |
$params['type'] = get_uri_params(); | |
$params['per_page'] = 10; | |
echo pagination( $params ); | |
*/ | |
function pagination( $params ) |
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
// Shawn Khameneh | |
// ExtraordinaryThoughts.com | |
(function($) { | |
var privateFunction = function() { | |
// 执行代码 | |
} | |
var methods = { | |
init: function(options) { |
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
//addition | |
Number.prototype.add = function(arg){ | |
var r1,r2,m; | |
try{r1=this.toString().split(".")[1].length}catch(e){r1=0} | |
try{r2=arg.toString().split(".")[1].length}catch(e){r2=0} | |
m=Math.pow(10,Math.max(r1,r2)) | |
return (this*m+arg*m)/m | |
} | |
//substruction |
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
<?php | |
/** | |
* @title: PHP多线程类(Thread) | |
* @version: 1.0 | |
* @author: phper.org.cn < web@phper.org.cn > | |
* @published: 2010-11-2 | |
* | |
* PHP多线程应用示例: | |
* require_once 'thread.class.php'; | |
* $thread = new thread(); |
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
<?php | |
/** | |
* Generate random passwords that are highly secure | |
* | |
* @return string | |
* @param $level 1:easy 2:Normal 3:Hard | |
* @author | |
**/ | |
function generatePassword($length = 6, $level = 2){ | |
list($usec, $sec) = explode(' ', microtime()); |
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
var base64 = {}; | |
(function(exports) { | |
var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | |
var base64DecodeChars = new Array(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1); | |
function base64encode(str) { | |
var out, i, len; | |
var c1, c2, c3; | |
len = str.length; | |
i = 0; |
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
class qrcode { | |
private $data; | |
//creating text qr code | |
public function text($text){ | |
$this->data = $text; | |
} | |
//creating code with link mtadata | |
public function link($url){ |
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
<?php | |
class MysqlDB { | |
protected $_mysql; | |
protected $_where = array(); | |
protected $_query; | |
protected $_paramTypeList; | |
protected $_crudType = null; |
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
//addition | |
Number.prototype.add = function(arg){ | |
var r1,r2,m; | |
try{r1=this.toString().split(".")[1].length}catch(e){r1=0} | |
try{r2=arg.toString().split(".")[1].length}catch(e){r2=0} | |
m=Math.pow(10,Math.max(r1,r2)) | |
return (this*m+arg*m)/m | |
} | |
//substruction |
OlderNewer