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 $new_object$ = $array$.reduce(($accumulator$, $current_value$) => { | |
$END$ | |
return $accumulator$; | |
}, $initial_value$); |
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
# ---------------------- | |
# Git Aliases | |
# ---------------------- | |
alias g='git' | |
alias ga='git add' | |
alias gaa='git add .' | |
alias gaaa='git add --all' | |
alias gau='git add --update' | |
alias gb='git branch' | |
alias gbd='git branch --delete ' |
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
export PROMPT_COMMAND= | |
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" | |
GREEN="\[\033[0;32m\]" | |
NO_COLOUR="\[\033[0m\]" | |
PURPLE="\[\033[0;35m\]" | |
export PS1="\[\033[38;5;6m\][\w]\[$(tput sgr0)\]\[\033[38;5;15m\]\\$\[$(tput sgr0)\]\[\033[38;5;6m\]:\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\] $GREEN\$(parse_git_branch)\n $NO_COLOUR" | |
function parse_git_branch () { |
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
function countingValleys(n, s) { | |
let valleys = 0; | |
let mountain = 0; | |
let lvl = 0; | |
if (n === 1) { | |
return 1; | |
} | |
if (n === 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
function Person(initialAge) { | |
// Add some more code to run some checks on initialAge | |
if (initialAge < 0) { | |
console.log("Age is not valid, setting age to 0."); | |
this.age = 0; | |
} else { | |
this.age = initialAge; | |
} |
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
function processData(input) { | |
//Enter your code here | |
const words = input.split('\n'); | |
let output = ''; | |
words.slice(1, words.length).forEach(word => { | |
let odd = ''; | |
let even = ''; | |
word.split('').forEach((input, index) => { |
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
function minimumBribes(q) { | |
let counter = 0; | |
let currentPosition = q.length - 1; | |
let log = ''; | |
let bribes; | |
while (currentPosition >= 0) { | |
const current = q[currentPosition]; | |
const orderPosition = currentPosition + 1; |
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
/** Task | |
/* Given an array, , of integers, print 's elements in reverse order as a single line of space-separated numbers. | |
**/ | |
function main() { | |
const n = parseInt(readLine(), 10); | |
const arr = readLine().split(' ').map(arrTemp => parseInt(arrTemp, 10)); | |
function reverseArray(toBeReversed) { | |
var reversed = []; |
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
<MyHair color="blue"> | |
My Head | |
</MyHair> |
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
React.createElement( | |
MyHair, | |
{color: 'blue'}, | |
'My Head' | |
) |