This file contains hidden or 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
const formatter = new Intl.NumberFormat('en-US', { | |
style: 'currency', | |
currency: 'USD', | |
minimumFractionDigits: 2 | |
}) | |
formatter.format(1000) // "$1,000.00" | |
formatter.format(10) // "$10.00" | |
formatter.format(123233000) // "$123,233,000.00" |
This file contains hidden or 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
LOADING | |
////////////////////////////////////////////////////////////////////////////////// | |
// queue scripts and fire a callback when loading is finished | |
head.load("file1.js", "file2.js", function() { | |
// do something | |
}); | |
// same as above, but pass files in as an Array | |
head.load(["file1.js", "file2.js"], function() { | |
// do something |
This file contains hidden or 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
universalLoading("class", "id"); |
This file contains hidden or 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
javascript shorthand list: https://www.sitepoint.com/shorthand-javascript-techniques/ | |
SCE function to get and check element // will avoid "of unexpected.." error: | |
let a = x0(".MobileSearchWrapperHelper"); | |
a ? a.style.display = "block" : void 0; | |
$(element).is(':visible') | |
element.offsetWidth > 0 && element.offsetHeight > 0; | |
window on load: |
This file contains hidden or 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
onclick="toggleActive(this, '0', true, false)" on any element | |
a = this | |
b = select parent '0' takes this element '-1' selects first parent, '-2' selects second parent, etc. | |
c = true|false remove/hide this element when clicked outside (great for tooltips, popups, etc) | |
d = run custom function after opening, example: myfunction() |
This file contains hidden or 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
$(window).bind("resize.rainbows", function(e){ | |
// do something when any span.rainbows element resizes | |
}); | |
$(window).unbind("resize.rainbows"); |
This file contains hidden or 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
https://github.com/daneden/animate.css | |
Add the class "animated" to the element you want to animate. You may also want to include the class infinite for an infinite loop. | |
Finally you need to add one of the following classes: | |
Class Name | |
bounce flash pulse rubberBand |
This file contains hidden or 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
UpdateQueryString(key, value, url, redirect) | |
url is not needed as it will generate automatically unless you want a different one | |
redirect = true or false |
This file contains hidden or 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
$('#element').hasClasses(['class1', 'class2', 'class3']); |
NewerOlder