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
const appState = { | |
items: [ | |
{ name: 'apples', checked: false }, | |
{ name: 'bananas', checked: true } | |
] | |
}; | |
// ============================ | |
// Item Creator | |
function createItem(itemName){ |
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
const fs = require('fs'); | |
const file = fs.readFileSync(__dirname + '/ex1-data.txt', 'utf8'); | |
const directions = file.split(',').map(i => i.trim()); | |
const Compass = { | |
MATRIX: ['N', 'E', 'S', 'W'], | |
left(start){ |
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: Spinal Tap Case | |
// Author: @mrskinny | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-spinal-tap-case?solution=function%20spinalCase(str)%20%7B%0A%20%20%2F%2F%20%22It%27s%20such%20a%20fine%20line%20between%20stupid%2C%20and%20clever.%22%0A%20%20%2F%2F%20--David%20St.%20Hubbins%0A%20%20%0A%20%20if%20(%20!str.match(%2F%5Cs%2F)%20%26%26%20!str.match(%2F%5C_%2F)%20)%20%7B%0A%20%20%20%20var%20newLetters%20%3D%20%5B%5D%3B%0A%20%20%20%20letters%20%3D%20str.split(%27%27)%3B%0A%0A%20%20%20%20for%20(%20var%20i%20%3D%200%2C%20_len%20%3D%20letters.length%3B%20i%20%3C%20_len%3B%20i%2B%2B)%7B%0A%20%20%20%20%20%20if%20(letters%5Bi%5D.toUpperCase()%20%3D%3D%3D%20letters%5Bi%5D)%20newLetters.push(%27-%27)%3B%0A%20%20%20%20%20%20newLetters.push(letters%5Bi%5D)%3B%0A%20%20%20%20%7D%0A%20%20%20%20str%20%3D%20newLetters.join(%27%27)%3B%0A%20%20%7D%0A%20%20%0A%20%20str%20%3D%20str.toLowerCase()%3B%0A%0A%20%20str%20%3D%20str.replace(%2F%5Cs%2Fg%2C%20%27-%27)%3B%0A%20%20str%20%3D%20str.replace(%2F%5C_%2Fg%2C% |