Skip to content

Instantly share code, notes, and snippets.

View muhittin's full-sized avatar

Muhittin Özer muhittin

View GitHub Profile
@muhittin
muhittin / select2_with_jqueryValidationEngine
Created May 29, 2014 11:39
select2 with jquery validation engine fix
$.each($(".select2-container"), function (i, n) {
$(n).next().show().fadeTo(0, 0).height("0px").css("left", "auto"); // make the original select visible for validation engine and hidden for us
$(n).prepend($(n).next());
$(n).delay(500).queue(function () {
$(this).removeClass("validate[required]"); //remove the class name from select2 container(div), so that validation engine dose not validate it
$(this).dequeue();
});
});
@muhittin
muhittin / email_url_phone_check.php
Last active August 29, 2015 14:04
Regex check for e-mail address, url and phone number in given string.
public static function findEmail($string)
{
$pattern = '/[a-z0-9_\-\+]+@[a-z0-9\-]+\.([a-z]{2,4})(?:\.[a-z]{2})?/i';
preg_match_all($pattern, $string, $matches);
return (count($matches[0]) > 0);
}
public static function findUrl($string)
{