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
| // as prototype | |
| Object.prototype.bindEvent = function(event, callback, bubble) { | |
| var elem = this, | |
| addListener = elem.addEventListener || elem.attachEvent, | |
| removeListener = elem.removeEventListener || elem.detachEvent, | |
| eventName; | |
| // custom "event" for ready | |
| if (event === 'ready') { | |
| eventName = document.addEventListener ? "DOMContentLoaded" : "onreadystatechange"; |
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 | |
| /** | |
| * Multi-Server MySQLi class | |
| * Givan a list of MySQL hosts, the client will connect to the first available server | |
| * $servers can be an string for single server, or, for multiple server, use an array or comma-separated list | |
| */ | |
| class multi_mysqli extends mysqli { | |
| // example from: http://php.net/manual/en/mysqli.real-connect.php | |
| public function __construct($servers=array(), $username='', $password='', $database='test') { |
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_client_ip() { | |
| $check_order = array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR'); | |
| $reserved_ips = array( | |
| array('0.0.0.0','2.255.255.255'), | |
| array('10.0.0.0','10.255.255.255'), | |
| array('127.0.0.0','127.255.255.255'), | |
| array('169.254.0.0','169.254.255.255'), | |
| array('172.16.0.0','172.31.255.255'), | |
| array('192.0.2.0','192.0.2.255'), | |
| array('192.168.0.0','192.168.255.255'), |
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 querify(str) { | |
| str = encodeURIComponent(str.replace(/,/gi, ' ').replace(/\s{2,}/gi, ' ')).replace(/%20/gi, '+'); | |
| return str; | |
| } |
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_meta_keywords() { | |
| var meta_keywords = ''; | |
| var metas = document.getElementsByTagName('meta'); | |
| if (metas) { | |
| for (var x=0,y=metas.length; x<y; x++) { | |
| if (metas[x].name.toLowerCase() == "keywords") { meta_keywords += metas[x].content; } | |
| } | |
| } | |
| return meta_keywords; |
NewerOlder