|
|
|
jquery |
form verilerini temizlemek | | function clearForm(form) {
// iterate over all of the inputs for the form
// element that was passed in
$(':input', form).each(function() {
var type = this.type;
var tag = this.tagName.toLowerCase(); // normalize case
// it's ok to reset the value attr of text inputs,
// password inputs, and textareas
if (type == 'text' || type == 'password' || tag == 'textarea')
this.value = "";
// checkboxes and radios need to have their checked state cleared
// but should *not* have their 'value' changed
else if (type == 'checkbox' || type == 'radio')
this.checked = false;
// select elements need to have their 'selectedIndex' property set to -1
// (this works for both single and multiple select elements)
else if (tag == 'select')
this.selectedIndex = -1;
});
}; |
Böyyük Patron Tarafından 17-02-2013 Tarihinde Gönderilmiştir.
Bu Konuyu Yazdır
Kaynak : |
|
|
jquery |
formda enter tuşuna basılmasını engellemek | | $("#formadi").keypress(function(e) {
if (e.which == 13) {
return false;
}
}); |
Böyyük Patron Tarafından 17-02-2013 Tarihinde Gönderilmiştir.
Bu Konuyu Yazdır
Kaynak : |
|
|
php |
adresten google map coordinatlarını öğrenmek | | function getLatLong($address){
if (!is_string($address))die("All Addresses must be passed as a string");
$_url = sprintf('http://maps.google.com/maps?output=js&q=%s',rawurlencode($address));
$_result = false;
if($_result = file_get_contents($_url)) {
if(strpos($_result,'errortips') > 1 || strpos($_result,'Did you mean:') !== false) return false;
preg_match('!center:\s*{lat:\s*(-?\d+\.\d+),lng:\s*(-?\d+\.\d+)}!U', $_result, $_match);
$_coords['lat'] = $_match[1];
$_coords['long'] = $_match[2];
}
return $_coords;
} |
Böyyük Patron Tarafından 17-02-2013 Tarihinde Gönderilmiştir.
Bu Konuyu Yazdır
Kaynak : |
|
|
| <?php
if (isDomainAvailible('http://www.codekodu.com'))
{
echo "Up and running!";
}
else
{
echo "Woops, nothing found there.";
}
//returns true, if domain is availible, false if not
function isDomainAvailible($domain)
{
//check, if a valid url is provided
if(!filter_var($domain, FILTER_VALIDATE_URL))
{
return false;
}
//initialize curl
$curlInit = curl_init($domain);
curl_setopt($curlInit,CURLOPT_CONNECTTIMEOUT,10);
curl_setopt($curlInit,CURLOPT_HEADER,true);
curl_setopt($curlInit,CURLOPT_NOBODY,true);
curl_setopt($curlInit,CURLOPT_RETURNTRANSFER,true);
//get answer
$response = curl_exec($curlInit);
curl_close($curlInit);
if ($response) return true;
return false;
}
?> |
Böyyük Patron Tarafından 17-02-2013 Tarihinde Gönderilmiştir.
Bu Konuyu Yazdır
Kaynak : |
|
|
|
.htaccess ile cache işlemleri | | # VERİYİ SIKIŞTIRRAK GÖNDER
SetOutputFilter DEFLATE
# 3 SAAT CACHE
<filesMatch ".(gif|jpg|jpeg|png|swf|bmp|js|css)$">
ExpiresActive On
Header set Cache-Control "max-age=10800"
</filesMatch>
# CACHE YAPMA
<filesMatch ".(php|cgi|pl|htm)$">
ExpiresActive Off
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
</filesMatch> |
Böyyük Patron Tarafından 22-01-2013 Tarihinde Gönderilmiştir.
Bu Konuyu Yazdır
Kaynak : |
|
|
|