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
<body> | |
<div class="header"> | |
<h2>Social Status Update Example</h2> | |
<h5>Using jQuery to add posts and remove on click. By Matt Luker </h5> | |
</div> | |
<div class="container"> | |
<form> | |
<div class="form-group"> | |
<textarea class="form-control status-box" rows="2" placeholder="What's on your mind?"></textarea> | |
</div> |
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
// Bonfire: Reverse a String | |
// Author: @mattnwa | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-reverse-a-string | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function reverseString(str) { | |
var result = str.split('').reverse(); | |
return result.join(''); | |
} |
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
// Bonfire: Check for Palindromes | |
// Author: @mattnwa | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-check-for-palindromes | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
//Steps to think through.. | |
// 1. we need to remove unneeded whitespace/numbers and whitespace. Needs to be lower case. | |
// 2. Need to then create another variable with the string turned into an array and reverse joined. | |
// 3. Compare the two created strings to see if they match. return F/A statement. |
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
// Bonfire: Find the Longest Word in a String | |
// Author: @mattnwa | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-find-the-longest-word-in-a-string | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function findLongestWord(str) { | |
strSplit = str.split(' '); | |
var longest = 0; | |
for(var i =0; strSplit.length >i; 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
// Bonfire: Title Case a Sentence | |
// Author: @mattnwa | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-title-case-a-sentence | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function titleCase(str) { | |
strLowercase = str.toLowerCase().split(' '); | |
for (var i =0; i <strLowercase.length; i++){ | |
strLowercase[i] = strLowercase[i].split(''); | |
strLowercase[i][0] = strLowercase[i][0].toUpperCase(); |
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
// Bonfire: Truncate a string | |
// Author: @mattnwa | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-truncate-a-string | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function truncate(str, num) { | |
// Clear out that junk in your trunk | |
if (num <=3) { | |
return str.slice(0, num) + "..."; |
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
// Bonfire: Chunky Monkey | |
// Author: @mattnwa | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-chunky-monkey | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function chunk(arr, size) { | |
var temp = []; | |
for(var i = 0; i < arr.length; i){ | |
temp.push(arr.slice(i, i+=size)); |
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
// Bonfire: Slasher Flick | |
// Author: @mattnwa | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-slasher-flick | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function slasher(arr, howMany) { | |
// it doesn't always pay to be first | |
if (howMany < 1) { | |
return arr; | |
} 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
// Bonfire: Mutations | |
// Author: @mattnwa | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-mutations | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function mutation(arr) { | |
var elem0 = arr[0].toLowerCase(); | |
var elem1 = arr[1].toLowerCase(); | |
for(var i = 0; i < elem1.length; 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
// Bonfire: Falsy Bouncer | |
// Author: @mattnwa | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-falsy-bouncer | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function bouncer(arr) { | |
// Don't show a false ID to this bouncer. | |
return arr.filter(Boolean); | |
} |
OlderNewer