Skip to content

Instantly share code, notes, and snippets.

View yokesharun's full-sized avatar
😬
Happy

Arun Yokesh yokesharun

😬
Happy
View GitHub Profile
@yokesharun
yokesharun / detect_your_device_type.js
Last active May 3, 2020 14:24
Javascript | Jquery : Detect Your Device either Mobile or Desktop
var is_mobile = 'No';
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
is_mobile = 'Yes';
}
// print your file output
@yokesharun
yokesharun / get_previous_url.js
Created February 8, 2016 13:26
Jquery get previous url of the browser
$(document).ready(function() {
var referrer = document.referrer;
console.log(referrer);
});
// open your console
@yokesharun
yokesharun / get_ip_address.js
Created February 8, 2016 13:30
Get your ip with Jquery
$.get("http://ipinfo.io", function(response) {
alert(response.ip);
}, "jsonp");
@yokesharun
yokesharun / generate_random_id.js
Created February 8, 2016 13:33
Generate random Characters with Jquery
function makeid()
{
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for( var i=0; i < 5; i++ )
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
@yokesharun
yokesharun / lite_random_generator.js
Created February 8, 2016 13:34
Single line Random key generator | id | jquery
Math.random().toString(36).substring(7);
@yokesharun
yokesharun / jquery_details_detect.js
Created February 8, 2016 13:37
Jquery Detect Browser name | browser version | os name | platform | os version | mobile | bit
(function (window) {
var browser,
version,
mobile,
os,
osversion,
bit,
ua = window.navigator.userAgent,
platform = window.navigator.platform;
@yokesharun
yokesharun / set_cookie.js
Created February 8, 2016 13:40
Javascript Set | create New cookie
@yokesharun
yokesharun / delete_cookie.js
Created February 8, 2016 13:40
Javascript delete cookie
@yokesharun
yokesharun / get_cookie_value.js
Created February 8, 2016 13:43
Javascript Get a cookie value by name
@yokesharun
yokesharun / return_path_url.php
Created February 9, 2016 06:32
PHP Get path | domain | Queries of the particular url
<?php
$url = '//www.example.com/path?googleguy=googley';
// Prior to 5.4.7 this would show the path as "//www.example.com/path"
var_dump(parse_url($url));
//output will be like
// array(3) {