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 | |
echo str_replace('/', '/<wbr>', $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
var str1 = "Ґав не лови"; | |
var str2 = "Єдність людини і природи"; | |
var res = str1.localeCompare(str2); // result: -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
<?php | |
/** | |
* The below functions take the single level array of items as an argument | |
* and turn it into a multidimensional array structure (tree), | |
* where each item has an array of sub-items. | |
* | |
* Each item should have at least an `id` and `parent_id`, | |
* where the `parent_id` is `0` if it's top level. | |
* | |
* Source: http://goo.gl/p2GybZ |
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
/* | |
* Source: http://css-tricks.com/snippets/jquery/password-strength/ | |
*/ | |
$('#pass').keyup(function(e) { | |
var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g"); | |
var mediumRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g"); | |
var enoughRegex = new RegExp("(?=.{6,}).*", "g"); | |
if (false == enoughRegex.test($(this).val())) { | |
$('#passstrength').html('More Characters'); | |
} else if (strongRegex.test($(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
/* | |
* Source: http://snipplr.com/view/62552/mage-resize/ | |
*/ | |
$(window).bind("load", function() { | |
// IMAGE RESIZE | |
$('#product_cat_list img').each(function() { | |
var maxWidth = 120; | |
var maxHeight = 120; | |
var ratio = 0; | |
var width = $(this).width(); |
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
/* | |
* Source: http://goo.gl/bi40M3 | |
*/ | |
$(function() { | |
$.fn.sortList = function() { | |
var mylist = $(this); | |
var listitems = $('li', mylist).get(); | |
listitems.sort(function(a, b) { | |
var compA = $(a).text().toUpperCase(); | |
var compB = $(b).text().toUpperCase(); |
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 | |
// Source: http://goo.gl/NOCJKM | |
$max = Table::model()->count(array( | |
'condition' => 'status<:status', | |
'params' => array('status' => Table::STATUS_A) | |
)); | |
$offset = rand(0, $max); |
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 ( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { | |
// some code... | |
} |
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 trim(str) { | |
var res = str.replace(/^\s+/, ''); | |
return res.replace(/\s+$/, ''); | |
} |
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
/* jQuery-based feature test for CSS position: fixed support. | |
Modified from Kangax's test (http://kangax.github.com/cft/#IS_POSITION_FIXED_SUPPORTED) in two ways: 1) uses jQuery API, 2) remove document.body dependency. | |
Method changes aside, the required workaround for dropping document.body use was to set scroll using window.scrollTo instead of body.scrollTop. | |
//Testing notes: | |
iOS4.3: false (expected) | |
iOS5: true (expected) | |
Chrome latest: true (expected) | |
...more soon | |
*/ |
OlderNewer