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
| /* | |
| Return true if the string in the first element of the array contains all of the letters of the string in the second element of the array. | |
| For example, ["hello", "Hello"], should return true because all of the letters in the second string are present in the first, ignoring case. | |
| The arguments ["hello", "hey"] should return false because the string "hello" does not contain a "y". | |
| Lastly, ["Alien", "line"], should return true because all of the letters in "line" are present in "Alien". | |
| */ | |
| function mutation(arr) { | |
| count = 0; | |
| arr[0] = arr[0].split("").map(function(x){return x.toLowerCase();}).join(""); | |
| var status = arr[1].split("").every(function(e){ |
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
| function fizzBuzz(val) { | |
| var msg = ''; | |
| if (val % 3 == 0) msg += 'Fizz' | |
| if (val % 5 ==0 ) msg +='Buzz' | |
| return (msg.length == 0 ? val : msg) ; | |
| } | |
| for (var i = 1; i <= 100; i++) { | |
| console.log(fizzBuzz(i)); | |
| } |
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
| var ferObject = { | |
| name: 'Todd', | |
| favouriteDrink: null, | |
| cool: false | |
| }; | |
| !!ferObject.name //true | |
| !!ferObject.favouriteDrink //false | |
| !!ferObject.cool //false | |
| !!ferObject.cools //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
| /*! | |
| * $rootScope listeners, remember to unbind on $destroy | |
| */ | |
| var $rootListeners = { | |
| 'transmitProgress': $rootScope.$on('transmit:progress', transmitProgress), | |
| 'transmitSuccess': $rootScope.$on('transmit:success', transmitSuccess), | |
| 'transmitError': $rootScope.$on('transmit:error', transmitError) | |
| }; | |
| // iterate the Object and pass the methods to be called on $destroy |
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
| #!/usr/bin/env python | |
| import yaml | |
| def generateHtml(msg): | |
| return ''' | |
| <li> | |
| <div class="collapsible-header"> | |
| <div class="text--size">{title}</div> | |
| </div> |
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
| import os | |
| from os import path | |
| def removeDots(filename): | |
| for n in ['.', ' ', ',']: | |
| filename = filename.replace(n, '') | |
| return filename | |
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
| "use strict"; | |
| const barker = (state) => ({ | |
| bark: () => console.log('Woof, I am ' + state.name) | |
| }) | |
| const driver = (state) => ({ | |
| drive: () => state.position = state.position + state.speed | |
| }) |
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 dog = () => { | |
| const sound = 'woof' | |
| return { | |
| talk: () => console.log(sound) | |
| } | |
| } | |
| const sniffles = dog() | |
| sniffles.talk() |
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
| import 'babelify/polyfill' | |
| function loadImage(url) { | |
| return new Promise((resolve, reject) => { | |
| let image = new Image() | |
| image.onload = function() { | |
| resolve(image) | |
| } |
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
| "use strict"; | |
| let categories = [ | |
| {id: 'animals', parent: null }, | |
| {id: 'mammals', parent: 'animals' }, | |
| {id: 'cats', parent: 'mammals' }, | |
| {id: 'dogs', parent: 'mammals' }, | |
| {id: 'chihuahua', parent: 'dogs' }, | |
| {id: 'labrador', parent: 'dogs' }, | |
| {id: 'persian', parent: 'cats' }, |