Skip to content

Instantly share code, notes, and snippets.

View NickFoden's full-sized avatar
🐯
I'm here live, i'm not a cat.

Nick Foden NickFoden

🐯
I'm here live, i'm not a cat.
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
</head>
<body>
https://courses.thinkful.com/fewd-001v6/project/2.6.6
First a function "getTokens" takes in a value rawString which is the text you are looking at.
It removes any special characters so that what is left of the string is just the words.
Then a new function takes that string and looks at each word through the string. As it goes word to word of the string it is looking for repeats. But how it does this is it makes a new array. And adds each word from the string to the array. If the word has already been added then the value goes up by one for each time it is added again. Each time a duplicate is added to the array, and already exists its count goes up.
Then next function looks for the word with the highest value, or count. If it comes across a word with a higher value then the one it just looked at then that new one becomes the max count. Or highest value. Leaving you at the end with the word that got the highest value, aka was repeated the most times.
@NickFoden
NickFoden / app.js
Created March 3, 2017 15:11
Text Analyzer
$(document).ready(function(){
$('.form').submit(function(event){
event.preventDefault();
var user_text = $('.form :input').val();
wordCount(user_text);
uniqueWordCount(user_text);
averageWordLength(user_text);
$('.text-report').removeClass('hidden');
@NickFoden
NickFoden / app.js
Created March 18, 2017 18:19
Challenge Tube
var YOUTUBE_BASE_URL = 'https://www.googleapis.com/youtube/v3/search /*add your api key*/
function getDataFromApi(searchTerm, callback) {
var settings = {
url: YOUTUBE_BASE_URL,
data: {
part: 'snippet',
q: searchTerm,
},
dataType: 'json',
@NickFoden
NickFoden / Salt and Pepper
Last active March 21, 2017 00:03
Salt And Pepper Statement
Randomized recipe ideas for your dinner party, after you make some basic selections.
If you don't like the first result, spin the wheel again. Or maybe just spin the paired cocktail wheel.