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 | |
function isNumeric($arr) | |
{ | |
return array_keys($arr) !== range(0, count($arr) - 1); | |
} |
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 | |
/** | |
* Works around an issue where the multibyte string extension | |
* can be configured to shadow strlen(), and no longer returns pure | |
* bytelength. | |
* @param string $str string to get byte length of | |
* @return int | |
*/ | |
function bytelen($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
<?php | |
/** | |
* Same as implode, but escape the separator when it exists in the array elements being imploded | |
* If the separator is longer than 1 character, only the first character need be escaped (not every character of the delimiter). | |
* | |
* @param string $sep delimiter to stich the array together with | |
* @param array $arr array to combine | |
* @param char $escape escape character to escape any found delimiters with | |
* @return imploded string |
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
ul { | |
list-style:none; | |
padding: 0 0 0 2em; /* padding includes space for character and its margin */ | |
/* IE7 and lower use default */ | |
*list-style: disc; | |
*padding: 0 0 0 1em; | |
} | |
ul li:before { | |
content: '\25BA'; |
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
@BASE_FONT_SIZE = 16; | |
@BASE_LINE_HEIGHT = 1.5; | |
// consistent base font size & line height (16px) | |
html { | |
font-size: 100%; | |
*font-size: 16px; | |
line-height: @BASE_LINE_HEIGHT; | |
} |
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
::-webkit-input-placeholder { /* WebKit browsers */ | |
color: #F00; | |
opacity: 1; | |
} | |
:-moz-placeholder { /* Mozilla Firefox 4 to 18 */ | |
color: #F00; | |
opacity: 1; | |
} | |
::-moz-placeholder { /* Mozilla Firefox 19+ */ | |
color: #F00; |
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
/** | |
* usage: date/time date/time ms->sec->min->hour->day | |
* getPeriodBetween('1 Jul 2011', '26 Oct 2010', 1000 * 60 * 60 * 24); | |
* | |
* = number of days between these two dates | |
*/ | |
function getPeriodBetween(date1, date2, timescale) | |
{ | |
return (new Date(date1) - new Date(date2)) / (timescale); | |
} |
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
/** | |
* A jquery plugin wrapper for a pure JavaScript class | |
* | |
* This will automatically give us the following: | |
* | |
* - a constructor for our class using $('my.selector').myClass() | |
* - automatic method access to the class's instance functions via syntax | |
* $('my.selector').myClass('funcName', arg1, arg2, ...argN); | |
* - automatic property access of all the class's internal properties. Both this | |
* and the above can assist greatly with third-party code integration |
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 | |
class CharsetConverter | |
{ | |
private static $WORD_CHARS_MAP = array( | |
"\xE2\x80\x9A" => "‚", | |
"\xE2\x80\x9E" => "„", | |
"\xE2\x80\x98" => "'", | |
"\xE2\x80\x99" => "'", | |
"\xE2\x80\x9C" => "\"", |
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($) { | |
var WATCH_FOCUS_ON = $(); | |
$.event.special['clickoutside'] = { | |
setup: function() | |
{ | |
WATCH_FOCUS_ON = WATCH_FOCUS_ON.add( this ); | |
// bind document handler if this is the first guy being bound |