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
/** | |
* Given an array of integers, move all zeros of the array to the end while | |
* maintaining the relative order of all non-zeros. | |
* | |
* Example: | |
* | |
* $ move0([1,3,0,111,57,0,5,0,9]) | |
* $ [1,3,111,57,5,9,0,0,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
/** | |
* Fireworks on New Year's Eve were great. This year, however, the fireworks | |
* company wants to avoid firing the same colour rocket twice in a row. Given an | |
* array of fireworks, return a valid firing order. If there is an impossible | |
* scenario, you can decide how to handle it. | |
* | |
* Example(s): | |
* | |
* firework(['green', 'green', 'pink', 'pink', 'orange']) | |
* ['green', 'pink', 'green', 'pink', 'orange'] |
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
/** | |
* Given an IPv4 address and a netmask in CIDR notation, return a boolean specifying whether the address is with the provided range. | |
* | |
* EXAMPLE(s) | |
* --- | |
* $ withinRange("10.0.3.33", "10.0.0.0/16") | |
* $ true | |
* | |
* $ withinRange("10.0.3.33", "10.0.1.0/24") | |
* $ false |
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
#!/usr/bin/env zsh | |
# Minimal theme based on clean, with git prompt ripped off from mortalscumbag | |
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="white"; fi | |
function my_git_prompt() { | |
tester=$(git rev-parse --git-dir 2> /dev/null) || return | |
INDEX=$(git status --porcelain 2> /dev/null) |