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
/* @import url('http://example.com/example_style.css'); */ | |
/** | |
* CSS @imports must be at the top of the file. | |
* Add them above this section. | |
*/ | |
/* ========================================================================== |
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 you have a sticky bar at the top of a webpage that's the same color as the page background, this will fade in a drop shadow below the bar to create a boundary on scroll */ | |
// jQuery | |
$(document).ready(function(){ | |
var a=$(".sticky-top-bar"); | |
$(window).scroll(function(){ | |
if($(document).scrollTop()>50){a.addClass("top-bar-shadow") | |
}else{a.removeClass("top-bar-shadow")}})}); | |
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
"use strict"; | |
var upper = 10000, | |
numToGuess = getRandomNumber(upper), | |
compGuess = getRandomNumber(upper), | |
numOfGuesses = 0, | |
correctGuess = false; | |
function getRandomNumber(upper) { | |
return Math.floor( Math.random() * upper ) + 1; |
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
"use strict"; | |
var upper = 10000, | |
numToGuess = getRandomNumber(upper), | |
compGuess, | |
numOfGuesses = 0; | |
function getRandomNumber(upper) { | |
return Math.floor( Math.random() * upper ) + 1; | |
} |
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 palindrome(str) { | |
// Good luck! | |
var re = /[\s\!\@\#\$\%\^\&\*\(\)\+\=\-/\\\\:\_]/g, | |
cleanStr, | |
revStr; | |
cleanStr = str.toLowerCase().replace(re, ""); | |
revStr = cleanStr.split("").reverse().join(""); | |
if (cleanStr === revStr) { | |
return true; | |
} else { console.log(cleanStr); } |
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 factorialize(num) { | |
var facArray = []; | |
if (num === 0) { | |
return 1; | |
} else { | |
for (var i = 1; i <= num; i++) { | |
facArray.push(i); |
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 collection = { | |
"2548": { | |
"album": "Slippery When Wet", | |
"artist": "Bon Jovi", | |
"tracks": [ | |
"Let It Rock", | |
"You Give Love a Bad Name" | |
] | |
}, | |
"2468": { |
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 reverseString(str) { | |
var strArray = str.split(""); | |
strArray.reverse(""); | |
return strArray.join(""); | |
} | |
reverseString("hello"); |
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
"use strict"; | |
const SALESTAX = .0975, | |
PHONE_PRICE = 200.00, | |
ACCESS_PRICE = 40.00; | |
var ba = prompt("How much money you got?"), | |
ac = prompt("When to stop buying accessories?"), | |
bankAccount = parseInt(ba), | |
accessoryLimit = parseInt(ac), |
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 findLongestWord(str) { | |
var strArray = str.split(" "), | |
arrCount = []; | |
for (var i = 0; i < strArray.length; i++) { | |
arrCount.push(strArray[i].length); | |
} | |
return Math.max(...arrCount); | |
} | |
findLongestWord("The quick brown fox jumped over the lazy dog"); |
OlderNewer