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
if (! function_exists('dump')) { | |
// Human readable print_r rendered by the browser. | |
function dump($var, $return = false) { | |
$str = '<pre style="text-align:left; border:1px solid #ccc; color:#000; background:#fff; margin:10px; padding:10px; background:rgba(255,255,255,0.7);">'.htmlentities(print_r($var, true)).'</pre>'; | |
while (preg_match('/((?!\[\[)([0-9]{10})(?!\]\]))/', $str, $matches)) { | |
$str = preg_replace('/'.$matches[1].'/', '{<strong>'.date('r', $matches[1])."</strong> <em>[[".$matches[1]."]]</em>}", $str); | |
} | |
if ($return) { return $str; } echo $str; | |
} | |
} |
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 print_r(obj, ret) { | |
var start = (new Date()), max_timeout = 100, max_calls = 1000, calls = 0, max_depth = 4, tab = " "; | |
if (ret == undefined) { ret = false; } | |
function _indent(depth) { var str = ''; for (var i = 0; i < depth; i++) { str += tab; } return str; } | |
function _print_r(obj, depth) { | |
var str = '', now = (new Date()), first = true, t = typeof obj; | |
if (now - start > max_timeout) { return '('+t+') [[timeout]]'; } | |
if (calls > max_calls) { return '('+t+') [[max calls]]'; } | |
if (depth > max_depth) { return '('+t+') [[max depth]]'; } |
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 konami_goal = '38 38 40 40 37 39 37 39 66 65 13'; | |
var konami_text = ''; | |
var konami_interval; | |
var konami_callbacks = { | |
'update':Array(), | |
'success':Array(), | |
'failure':Array(), | |
'timeout':Array(), | |
}; |
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
$.extend($.expr[":"], { | |
"containsNC": function(elem, i, match, array) { | |
return (elem.textContent || elem.innerText || "").toLowerCase | |
().indexOf((match[3] || "").toLowerCase()) >= 0; | |
} | |
}); | |
$(function() { | |
$('[filterselect]').each(function() { | |
$(this).change(function() { |
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() { | |
$('[smartdefault]').each(function() { | |
$(this).focus(function() { | |
if ($(this).hasClass('smartdefault')) { | |
$(this).val('').removeClass('smartdefault'); | |
// Uncomment the following line to make it stick | |
// $(this).removeAttr('smartdefault'); | |
} | |
}).blur(function() { | |
if (! $(this).val()) { |
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 serial_comma($array, $serial_comma = true, $conjunction = 'and') { | |
$size = sizeof($array); | |
switch($size) { | |
case 0: | |
case 1: | |
return reset($array); | |
case 2: | |
return implode(' '.$conjunction.' ', $array); | |
default: | |
return implode(', ', array_slice($array, 0, $size - 1)).($serial_comma?',':'').' '.$conjunction.' '.$array[$size - 1]; |
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
/** | |
* PREG Escape- escapes regex metacharacters for inserting into a generated regex; | |
* | |
* @param String $text The text input to escape | |
* @return String a regex safe matching string. | |
*/ | |
function preg_escape($statement) { | |
$metas = Array('\\', '^', '[', '.', '%', '$', '{', '*', '(', '+', ')', '|', '?', '<', '>', '/', '-', '=', ' '); | |
foreach ($metas as $char) { | |
$statement = str_replace($char, '\\'.$char, $statement); |
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($) { | |
$.fn.lameroll = function(data) { | |
this.prefs = $.extend($.fn.lameroll.defaults, data); | |
this.css({ | |
"width":this.prefs.width, | |
"height":this.prefs.height, | |
"list-style-type":"none", | |
"display":"block", |
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_params($url) { | |
$param_regex = "/[\?\&]{1}([^=]+)(\=([^\&\=]*))?/"; | |
preg_match_all($param_regex, $url, $matches); | |
$params = Array(); | |
foreach ($matches[1] as $index => $key) { | |
$params[$key] = ($matches[2][$index]?$matches[3][$index]:null); | |
} | |
return $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
<?php | |
error_reporting(E_ALL); | |
function getExtension($filename, &$base = NULL) { | |
$a = split('\.', $filename); | |
$ext = array_pop($a); | |
$base = join('.', $a); | |
return strtolower($ext); | |
} |
OlderNewer