Skip to content

Instantly share code, notes, and snippets.

View fakiolinho's full-sized avatar
🤘
Leading as usual...

Fakiolas Marios fakiolinho

🤘
Leading as usual...
View GitHub Profile
@fakiolinho
fakiolinho / HTML: HTML5 Default Template
Created April 21, 2013 11:38
HTML: HTML5 Default Template
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<!-- Favicons Start -->
<!-- In case image.ico -->
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
@fakiolinho
fakiolinho / jQuery: jQuery Existence
Created April 21, 2013 12:02
jQuery: jQuery Existence
<!-- Check if jQuery already exists -->
<script type="text/javascript">
(function() {
if(window.jQuery === undefined)
{
document.write('<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"><\/script>');
}
else
{
jQuery = window.jQuery;
@fakiolinho
fakiolinho / HTML: Favicons
Created April 21, 2013 12:11
HTML: Favicons
<!-- Favicons -->
<!-- In case image.ico -->
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<!-- In case image.png -->
<link rel="shortcut icon" type="image/png" href="favicon.png" />
<!-- Apple Devices -->
<link rel="apple-touch-icon" href="60x60.png">
@fakiolinho
fakiolinho / jQuery-HTML-CSS: Scroll to Top
Created April 21, 2013 20:57
jQuery-HTML-CSS: Scroll to Top
/* jQuery Scroll to Top */
function scrollTop() {
$(window).scroll(function() {
$(window).scrollTop() > 50 ? $('#top').fadeIn('slow') : $('#top').fadeOut('slow');
});
$('a[href=#top]').click(function() {
$('html, body').animate({scrollTop:0}, 'slow');
return false;
});
@fakiolinho
fakiolinho / jQuery: IE Placeholder Issue
Last active December 16, 2015 11:59
jQuery: IE Placeholder Issue
/* If browser doesn't recognize attr placeholder change inputs value on focus/blur with the placeholder value */
/* Works for jQuery version > 1.9 were $.browser was deprecated and cannot be used anymore */
function iePlaceholder() {
if(document.createElement("input").placeholder == undefined)
{
$(':input').each(function() {
var input = $(this);
$(input).val(input.attr('placeholder'));
@fakiolinho
fakiolinho / CSS: Reset CSS
Created April 22, 2013 13:14
CSS: Reset CSS
/*
|--------------------------------------------------------------------------
| XHTML, HTML4, HTML5 Reset CSS
|--------------------------------------------------------------------------
*/
a,
abbr,
acronym,
address,
@fakiolinho
fakiolinho / jQuery: Validate Email with Regex
Last active March 25, 2022 05:47
jQuery: Validate Email with Regex
/* jQuery Validate Emails with Regex */
function validateEmail(Email) {
var pattern = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
return $.trim(Email).match(pattern) ? true : false;
}
@fakiolinho
fakiolinho / jQuery: Validate Strings with Regex
Last active December 13, 2021 18:44
jQuery: Validate Strings with Regex
/* jQuery Validate Strings with Regex */
function validateStrings(string) {
var pattern = /^[0-9a-zA-Z@_-]+$/;
return $.trim(string).match(pattern) ? true : false;
}
@fakiolinho
fakiolinho / JS: Single Custom Object
Created May 12, 2013 00:01
JS: Single Custom Object
//Create a single custom object
var object = {
attribute1: 'value1',
attribute2: 'value2',
method1: function() {
return this.attribute1 + ' ' + this.attribute2;
}
};
@fakiolinho
fakiolinho / JS: Custom Object for Multiple Instances
Last active December 17, 2015 05:59
JS: Custom Object for Multiple Instances
//Create a custom object for multiple instances
function object(attribute1, attribute2) {
this.attribute1 = attribute1;
this.attribute2 = attribute2;
this.method1 = function() {
return this.attribute1 + ' ' + this.attribute2;
};
}