Skip to content

Instantly share code, notes, and snippets.

View logeshpaul's full-sized avatar

Logesh Paul logeshpaul

View GitHub Profile
@logeshpaul
logeshpaul / gist:1998946
Created March 8, 2012 05:41
HTML: Start Template
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title></title>
<!-- STYLESHEETS -->
<link href="styles/bootstrap.css" rel="stylesheet" type="text/css">
<link href="styles/main.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="favicon.ico">
@logeshpaul
logeshpaul / extractNumbers.js
Last active November 19, 2021 02:16
Js: Extract Numbers from String
var extractNumbers = $(this).val().replace(/[^\d]/g, "");
@logeshpaul
logeshpaul / gist:2250240
Created March 30, 2012 09:19
JS: Mouse hover function (Twitter Following)
$('.flag-following').mouseover(function(){
$('.flag-following img').attr("src", "images/flag-following-on.png");
});
$('.flag-following').mouseout(function(){
$('.flag-following img').attr("src", "images/flag-following-off.png");
});
@logeshpaul
logeshpaul / gist:2250257
Created March 30, 2012 09:21
Js: Remove debugging codes (console.*)
<!-- include firebugx only in prod in case console.* got forgotten -->
<script type="text/javascript">
var names = ["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];
window.console={};
for(var i=0;i<names.length;++i)window.console[names[i]]=function(){}
</script>
@logeshpaul
logeshpaul / gist:2250402
Created March 30, 2012 09:45
Js: Redirect to url
onClick="location.href='dashboard.html'"
@logeshpaul
logeshpaul / gist:2250413
Created March 30, 2012 09:46
Js: Prevent from navigating to top
href="javascript:void(null);"
@logeshpaul
logeshpaul / gist:2250437
Created March 30, 2012 09:50
Modernizer: Placeholder
if(!Modernizr.input.placeholder){
$("input").each(function(){
if($(this).val()=="" && $(this).attr("placeholder")!=""){
$(this).val($(this).attr("placeholder"));
$(this).focus(function(){
if($(this).val()==$(this).attr("placeholder")) $(this).val("");
});
$(this).blur(function(){
if($(this).val()=="") $(this).val($(this).attr("placeholder"));
});
@logeshpaul
logeshpaul / gist:2250541
Created March 30, 2012 10:03
Js: Custom input file - Get filename
$(".browse-container-inner .default-browse-button").live("change", function() {
var a = $(this).val().split("\\").pop();
return $(this).parent().siblings(".browse-text").val(a);
}
@logeshpaul
logeshpaul / gist:2575518
Created May 2, 2012 09:29
CSS: Selection
::selection {
background: #FE57A1;
color: white;
text-shadow: none;
}
@logeshpaul
logeshpaul / gist:2652168
Created May 10, 2012 09:42
Js: jQuery fallback
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
if (typeof jQuery == 'undefined') {
document.write(unescape("%3Cscript src='/scripts/jquery-1.7.2.min.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>