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 ToggleMenu = props => { | |
const [isOpen, setOpen] = useState(false) | |
const toggleNav = () => setOpen(!isOpen) | |
const nodeRef = useRef() | |
useEffect(() => { | |
const handleOutsideClick = e => { | |
if (!nodeRef.current.contains(e.target)) { | |
toggleNav() |
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 pics = { | |
panda: "http://bit.ly/1Tqltv5", | |
owl: "http://bit.ly/1XGtkM3", | |
owlCat: "http://bit.ly/1Upbczi" | |
}; | |
const panda = ( | |
<img | |
src={pics.panda} | |
alt="Lazy Panda" /> |
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
npm install webpack --save-dev | |
# install webpack for dev env only |
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
/* | |
Requires html button with at least two unit options. | |
Unit setting is saved in local storage. | |
*/ | |
// PX to REM Conversion | |
if (Modernizr.localstorage) { | |
// ----------------- On initial load: check local storange and convert units | |
toggle_pxrem(); |
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
log/diff --stat | |
# diagram of changes per file | |
log/diff --shortstat | |
# count of changes | |
log --oneline | |
# sha + commit messages | |
shortlog |
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
# Startup command to set terminal prompt to working directory basename | |
export PS1="\[\033[38;5;116m\]\W \$\[\033[00m\] "; clear; cd [path/to/working_directory] | |
# working_directory $ |
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
/* | |
Solution for HackerRank > Algorithms > Warmup > Circular Array Rotation | |
https://www.hackerrank.com/challenges/circular-array-rotation | |
*/ | |
function sherlock() { | |
// Number of rotations | |
var k = 51; | |
// Array of Integers | |
var arr = [39356, 87674, 16667, 54260, 43958, 70429, 53682, 6169, 87496, 66190, 90286, 4912, 44792, 65142, 36183, 43856, 77633, 38902, 1407, 88185, 80399, 72940, 97555, 23941, 96271, 49288, 27021, 32032, 75662, 69161, 33581, 15017, 56835, 66599, 69277, 17144, 37027, 39310, 23312, 24523, 5499, 13597, 45786, 66642, 95090, 98320, 26849, 72722, 37221, 28255, 60906]; |
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
/* | |
Solution for HackerRank > Algorithms > Implementation > Cut The Sticks | |
https://www.hackerrank.com/challenges/cut-the-sticks | |
*/ | |
function cutSticks() { | |
var n = 8; // Number of sticks | |
arr = [1,2,3,4,3,3,2,1]; // Stick length | |
while (arr.length > 0){ |
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
/* | |
Solution for HackerRank > Algorithms > Implementation > Kangaroo | |
https://www.hackerrank.com/challenges/kangaroo | |
In this example, 0 <= x1 <= x2 | |
*/ | |
function kangaroos() { | |
var x1 = 43; | |
var v1 = 5; |
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
/* | |
Solution for HackerRank > Algorithms > Strings > Beautiful Binary String | |
https://www.hackerrank.com/challenges/beautiful-binary-string | |
*/ | |
function main(){ | |
var B = '0100101010'; | |
var stepCount = 0; | |
// While the substring '010' exists, replace it with '011'. |
NewerOlder