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
/** | |
* Dropdown Component | |
* | |
* Add 'data-dropdown' and 'aria-controls' with the element id to toggle | |
*/ | |
const Dropdown = () => { | |
const dropdowns = document.querySelectorAll('[data-dropdown]'); | |
// If there's no wrapper, bail. |
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 isRequired = () => { throw new Error('param is required'); }; | |
function filterEvil(array, evil = isRequired()) { | |
return array.filter(item => item !== evil); | |
} |
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
window.onload = function() { | |
init(); | |
otherFn(); | |
} | |
function init() { | |
var myPromise = new Promise(function(resolve, reject){ | |
setTimeout(function() { | |
resolve("Promise called!"); | |
}, 1000); |
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
#!/bin/bash | |
# Declaring functions | |
function display() { | |
echo "Hello" $1 "!" | |
} | |
# ./my_script.sh param1 param2 | |
# $0 (script name) | |
# $1 .. $n (nth parameter) |
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
#!/bin/bash | |
! # Start a history substitution | |
!$ # Refer to the last argument in a line | |
!string # Refer to the most recent command starting with string | |
# example | |
echo !$ | |
# Network |
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
#!/bin/bash | |
# Calculate parameters | |
cvt 1920 1080 | |
# Create new mode | |
xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync | |
# Add new mode to screen | |
xrandr --addmode VGA-0 "1920x1080_60.00" |