This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![end if]--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Checboxes --> | |
<form id="productCategories"> | |
<input type="checkbox" name="product[]" value="vitamin" checked>Vitamin<br> | |
<input type="checkbox" name="product[]" value="mineralwater" checked>Mineral Water<br> | |
<input type="checkbox" name="product[]" value="proteinbar" checked>Proteinbar | |
</form> | |
<!-- List Items --> | |
<ul class="product-list"> | |
<li class="product-item" data-prod_id="V-BC2178"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var position, direction, previous; | |
$(window).scroll(function(){ | |
if( $(this).scrollTop() >= position ){ | |
direction = 'down'; | |
if(direction != previous){ | |
$('.menu-toggle').addClass('hide'); | |
previous = direction; | |
} | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Smooth Scroll | |
jQuery(function() { | |
jQuery('a[href*="#"]:not([href="#"])').click(function() { | |
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { | |
var target = jQuery(this.hash); | |
target = target.length ? target : jQuery('[name=' + this.hash.slice(1) +']'); | |
if (target.length) { | |
jQuery('html, body').animate({ | |
scrollTop: target.offset().top | |
}, 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){ | |
var httpRequest, root; | |
root = 'https://jsonplaceholder.typicode.com'; // URL for JSON data | |
document.querySelector('.ajaxButton').addEventListener('click', makeRequest); | |
function makeRequest() { | |
httpRequest = new XMLHttpRequest(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var observer = new MutationObserver(function (mutations) { | |
mutations.forEach(function (mutation) { | |
if (!mutation.addedNodes) return | |
for (var i = 0; i < mutation.addedNodes.length; i++) { | |
var item = Array.prototype.slice.call(mutation.addedNodes).find(function (i) { return i.id == "selector" }); | |
if (item) { | |
// Do your stuff here | |
observer.disconnect(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"lastUpload":"2020-02-24T12:47:51.099Z","extensionVersion":"v3.4.3"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Phone Number format 000-000-0000 | |
export const formattedPhoneRegex = /^[0-9]\d{2}-\d{3}-\d{4}$/i; | |
export const emailRegex = /^[a-z0-9`!#\$%&\*\+\/=\?\^\'\-_]+((\.)+[a-z0-9`!#\$%&\*\+\/=\?\^\'\-_]+)*@([a-z0-9]+([\-][a-z0-9])*)+([\.]([a-z0-9]+([\-][a-z0-9])*)+)+$/i; | |
// No Special Chars | |
export const noSpecialCharRegex = /^[a-zA-Z0-9]+$/i; | |
// Auto format the phone number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// To delete all merged branches except master and dev | |
git branch --merged | grep -v '\*\|master\|dev' | xargs -n 1 git branch -d | |
// To delete all branches except master and dev: | |
git branch | grep -v '\*\|master\|dev' | xargs -n 1 git branch -D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ES5 example | |
function Subject () { | |
this.observers = []; // Array of observer functions | |
} | |
Subject.prototype = { | |
subscribe: function (fn) { | |
this.observers.push(fn) | |
}, |
OlderNewer