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 lengthLongestPath = input => { | |
return input.split('\n').reduce((os, path) => { | |
const idx = path.lastIndexOf('\t') + 1; | |
idx <= os.filePath.length && os.filePath.splice(idx); | |
os.filePath.push(path.slice(idx)); | |
if (path.lastIndexOf('.') >= 0) { | |
const length = os.filePath.join('/').length; | |
os.longest = length > os.longest ? length : os.longest; |
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 printCombinations = (list, k, prefix = '') => { | |
if (!k) { | |
return console.log(prefix); | |
} | |
for (let i = 0; i < list.length; i++) { | |
printCombinations(list, k - 1, `${prefix}${list[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
// actions - streams | |
function makeStreamSettingsPayload(opts) { | |
return { | |
id: 'UPDATE_CONFIG', | |
payload: { | |
action: 'updateviewconfig', | |
userviewconfig: opts.streamSettings | |
} | |
}; |
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 loneSurvivor = function () { | |
// create a list of players | |
var players = []; | |
for (var i = 1; i <= 100; i++) { | |
players.push(i); | |
} | |
// how many to step over | |
var step = 0; | |
var iterations = 0; |
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
language: node_js | |
node_js: | |
- '0.10' | |
- '0.11' | |
before_script: | |
- npm install -g bower grunt-cli | |
- bower install | |
services: mongodb | |
notifications: | |
slack: hr22-23:cj7Wc706h8pEu4BGApvLCuJc |
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'; | |
describe('Controller: MessageCtrl', function () { | |
var scope; | |
var state; | |
var messageService; | |
// load controller views | |
var views = [ |
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
set nocompatible | |
set nobackup | |
set shell=$HOME/.oh-my-zsh | |
syntax on | |
set incsearch | |
set hlsearch | |
set ignorecase | |
set smartcase | |
set guifont=Monaco:h13 | |
set background=dark |
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 J500px = function () { | |
this.ajaxLoader = 'images/ajax-loader.gif'; | |
this.categories = ['Travel', 'Popular', 'sports', 'Journal']; // look into 500px doc to get a full list of categories | |
}; | |
J500px.prototype = { | |
// Displays the AJAX loader | |
displayLoader: function () { | |
var $loader = $('<div id="ajax-loader">'); | |
var $imgLoader = $('<img>'); |
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
=================================================== | |
// In case you didn't know, there is a Math object | |
// with all sorts of cool methods attached to it | |
// Let's take a look at Math.max(); | |
// Call Math.max with an array of numbers | |
// i.e. Math.max(1,5,75,4,11); | |
Math.max(1, 2, 3, 4); | |
// Now declare a variable allNums that references a |
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
// Using the JavaScript language, have the function LetterCount(str) take the str parameter being passed and return the first word with the greatest number of repeated letters. For example: "Today, is the greatest day ever!" should return greatest because it has 2 e's (and 2 t's) and it comes before ever which also has 2 e's. If there are no words with repeating letters return -1. Words will be separated by spaces. | |
// Input = "Hello apple pie" Output = Hello | |
// Input = "No words" Output = -1 | |
function LetterCount( str ) { | |
var words = str.split( ' ' ); | |
var longest = 0; | |
var longest_word; | |
for ( var i = 0; i < words.length; i++ ) { |
NewerOlder