- The question must make sense to you before you ask it
- Avoid being seen as a 'help vampire'
- This seems to be a hack reactor idea
" leader as spacebar | |
let mapleader = " " | |
" Enable syntax highlighting | |
syntax on | |
" Search Highlighting | |
set hlsearch | |
" Mute highlighting | |
nnoremap <silent> <C-l> :<C-u>nohlsearch<CR><C-l> |
/* | |
Kth Missing Positive Number | |
Given an array arr of positive integers sorted in a strictly increasing order, and an integer k. | |
Find the kth positive integer that is missing from this array. | |
Example 1: |
# Aliases go in bashrc, customizing $PATH environment variable in bash_profile | |
export PS1="___________________ | \w @ \h (\u) \n| => " | |
export PS2="| => " | |
# Aliases | |
alias git-pull-all="find . -maxdepth 3 -name .git -type d | rev | cut -c 6- | rev | xargs -I {} git -C {} pull" | |
# Update bashrc gist: https://gist.github.com/Ashwinning/35f530be96754e71a138af842d147cf8 | |
alias gistbash="gist -u 9d5f4e7e2139d93e6011f529d06c8b38 ~/.bash_profile" |
package com.galvanize.demo; | |
import org.springframework.web.bind.annotation.GetMapping; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.RequestParam; | |
import org.springframework.web.bind.annotation.RestController; | |
import java.util.Map; | |
import static java.lang.Integer.parseInt; |
const getDecimalValue = (head, [currentNode, string] = [head, '']) => { | |
do { | |
string += currentNode.val; | |
currentNode = currentNode.next; | |
} while (currentNode) | |
return parseInt(string, 2); | |
} | |
const getDecimalValue = (h, [c, a] = [h, []]) => { | |
do { |
const maxDistToClosest = (seats, | |
[maxDist, i, j] = [0, 0, 1], | |
{ length } = seats) => { | |
const leftSeatOccupied = () => seats[i] === 1; | |
const rightSeatOccupied = () => seats[j] === 1; | |
const isEndOfRow = () => (j + 1) === length; | |
const distanceToEndOfRow = () => j - i; | |
const distanceBetweenSeats = () => Math.ceil(((j - 1) - i) / 2); | |
const seatsLeftInRow = () => j < length; | |
const checkNextRightSeat = () => j += 1; |
const summaryRanges = (nums, [beginning, end] = [nums[0]]) => { | |
return nums.reduce((result, curr, i) => { | |
const next = nums[i + 1]; | |
if (curr + 1 !== (next)) { | |
result.push(end === beginning ? `${end}` : `${beginning}->${end}`); | |
beginning = next; | |
} | |
end = next; | |
return result; | |
}, []); |
const removeCoveredIntervals = (intervals) => { | |
let coveredIntervalsCount = 0; | |
const compareSet = new Set(); | |
for (let i = 0; i < intervals.length; i += 1) { | |
const current = intervals[i]; | |
for (let j = 0; j < intervals.length; j += 1) { | |
if (j === i || compareSet.has((intervals[j].toString()))) { | |
continue; | |
} | |
const compare = intervals[j]; |
Loader.io test: | |
Endpoint: http://<proxy>/reviews/api/item/%{*:1-10000000}/reviews | |
Specifications: 400 clients per second over 1 minute | |
New Relic results: | |
Peak throughput: 292 rps | |
Peak latency: 650ms. |