Sadace Integer Karakterlere İzin Verme

$(“input[name=number]“).keydown(function (e) { // Allow: backspace, delete, tab, escape, enter and . if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 || // Allow: Ctrl+A, Command+A (e.keyCode == 65 && ( e.ctrlKey === true || e.metaKey === true ) ) || // Allow: home, end, left, right, down, up (e.keyCode >= 35 && […]

Read More

_gaq.push() is not a function

if (typeof _gaq === ‘undefined’ || typeof _gaq !== ‘object’) { var _gaq = {}; _gaq.push = function(array){ if(array[0] === ‘_trackPageview’){ dataLayer.push({ ‘event’: ‘pageview’, ‘pagePath’: array[1] }); }else if(array[0] === ‘_trackEvent’){ dataLayer.push({ ‘event’: ‘event’, ‘category’: array[1], ‘action’: array[2], ‘label’: array[3], ‘value’: array[4] }); } } }

Read More

No-Cache Meta

PHP header(‘Cache-Control: no-cache, no-store, must-revalidate’); // HTTP 1.1. header(‘Pragma: no-cache’); // HTTP 1.0. header(‘Expires: 0′); // Proxies. Java Servlet response.setHeader(“Cache-Control”, “no-cache, no-store, must-revalidate”); // HTTP 1.1. response.setHeader(“Pragma”, “no-cache”); // HTTP 1.0. response.setDateHeader(“Expires”, 0); // Proxies. ASP.NET Response.AppendHeader(“Cache-Control”, “no-cache, no-store, must-revalidate”); // HTTP 1.1. Response.AppendHeader(“Pragma”, “no-cache”); // HTTP 1.0. Response.AppendHeader(“Expires”, “0″); // Proxies. ASP Response.addHeader “Cache-Control”, […]

Read More

Node.js MySql Bağlantısı

Önce mysql eklentisini kurduktan sonra; var mysql = require(‘mysql’); var connection = mysql.createConnection({ host: ‘localhost’, user: ‘root’, password: ”, database: ‘test’, port: 3306 }); connection.connect(); var query = connection.query( ‘SELECT * FROM users’, function(err, result, fields){ if(err) throw err; console.log(‘result: ‘, result); } ); connection.end();

Read More

Node.js Basit RestApi

package.json { “name”: “node-api”, “main”: “server.js”, “dependencies”: { “express”: “~4.0.0″, “body-parser”: “~1.0.1″, “mysql”: “*”, “sequelize”: “*”, “crypto”: “*” } } user.js var users = [ { "id": "1", "name": "Mark Brown", "age": 27 }, { "id": "2", "name": "Tim Gray", "age": 29 }, { "id": "3", "name": "Mark Blue", "age": 27 } ]; exports.getAllUsers = […]

Read More

Ajax Post vs. jQuery Post

$.ajax({ url: site_url + “ajax/post”, data: ({‘email’: email, ‘password’: password}), type: “post”, success: function(response, textStatus, jqXHR){ $(‘#sign-up’).html(response); } }); $.post(site_url + “ajax/post”, {‘email’: email, ‘password’: password}, function(html){ $(‘#sign-up’).html(html); });

Read More

Table Sorting

function sortTable(col, type){ var rows = $(‘table tbody tr’).get(); rows.sort(function(a, b) { var A = $(a).children(‘td’).eq(col).text().toUpperCase(); var B = $(b).children(‘td’).eq(col).text().toUpperCase(); if(A < B) { if(type === 'asc'){ return -1; }else{ return 1; } } if(A > B) { if(type === ‘asc’){ return 1; }else{ return -1; } } return 0; }); $.each(rows, function(index, row) { […]

Read More

JSON Array Sorting Fonksiyonu

var arr = [ { "ID": 1, "Name": "Fargo Chan", "Age": 21 }, { "ID": 5, "Name": "Aaron Luke", "Age": 18 }, { "ID": 2, "Name": "Dilip Singh", "Age": 32 } ]; 1. Yöntem: function SortByID(x,y) { return x.ID – y.ID; } function SortByName(x,y) { return ((x.Name == y.Name) ? 0 : ((x.Name > y.Name) […]

Read More

Div Autoload ve Refresh

<script src=”https://code.jquery.com/jquery-2.1.1.min.js” type=”text/javascript”></script> <script> $(document).ready(function(){ setInterval(function(){ $(“#screen”).load(‘banners.php’) }, 2000); }); </script> <?php $bg_array = array(“#CEED9D”,”#ECED9D”,”#EDCF9D”,”#EC9CA7″,”#ED9DD0″,”#EE9DE2″,”#D69DEC”,”#9E9CEC”); $bg = array_rand($bg_array,1); ?> <div class=”banner” style=”background-color:<?php echo $bg_array[$bg];?>;” > <div class=”txt-title”>jQuery DIV Auto Load Refresh</div> <div class=”txt-subtitle”>This Banner auto loads and refreshes every 2 seconds.</div> </div>

Read More

Parola Zorluk Seviyesi Kontrolü

<div name=”frmCheckPassword” id=”frmCheckPassword”> <label>Check Username:</label> <input type=”password” name=”password” id=”password” class=”demoInputBox” onKeyUp=”checkPasswordStrength();” /><div id=”password-strength-status”></div> </div> function checkPasswordStrength() { var number = /([0-9])/; var alphabets = /([a-zA-Z])/; var special_characters = /([~,!,@,#,$,%,^,&,*,-,_,+,=,?,>,<])/; if($(‘#password’).val().length<6) { $(‘#password-strength-status’).removeClass(); $(‘#password-strength-status’).addClass(‘weak-password’); $(‘#password-strength-status’).html(“Weak (should be atleast 6 characters.)”); } else { if($(‘#password’).val().match(number) && $(‘#password’).val().match(alphabets) && $(‘#password’).val().match(special_characters)) { $(‘#password-strength-status’).removeClass(); $(‘#password-strength-status’).addClass(‘strong-password’); $(‘#password-strength-status’).html(“Strong”); } else { $(‘#password-strength-status’).removeClass(); […]

Read More