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
<< DOC | |
Usae: | |
mage2_module_scaffold <vendor> <module> | |
Note: | |
This command is destructive — it will ovewrite app/code/<vendor>/<module>/etc/module.xml | |
DOC | |
mage2_module_scaffold() { | |
local vendor=$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
grep 'ms' $LOG_FILE | awk '{print $(NF-0)}' | tr -d '()ms' | paste -sd+ - | bc |
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
_ | |
| |__ ___ ___ | |
| '_ \ / _ \/ _ \ | |
| |_) | __/ __/ | |
|_.__/ \___|\___| | |
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 bash | |
if ! command -v gulp > /dev/null; then | |
echo && echo "error: gulp required" | |
exit 1 | |
fi | |
gulp build | |
if ! command -v md5sum > /dev/null; then |
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 makeProblems(count) { | |
var problems = []; | |
for (var i = 0; i < count; i++) { | |
var problematic = function(runId) { | |
console.log(runId + ' executed with i as: ' + i); // <-- `i` is bound to makeProblems scope | |
}; | |
problems.push(problematic); |
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
# assuming you have a root stylesheet like app/assets/stylesheets/application.scss you can easily generate all your import | |
# statements with a single line of BASH | |
# look in all of the sub-folders of app/assets/stylesheets/ for scss files | |
# find app/assets/stylesheets/*/* -name '*.scss' | |
# ignore the first 24 characters of the path (i.e. `app/assets/stylesheets/`) | |
# cut -c 24- | |
# create import statement for each file found | |
# awk '{print "@import \"" $1"\";"}' | |
# remove any distracting leading underscores from the filenames |
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 bash | |
apm_lazy_install() { | |
for package in $@; do | |
apm list | grep $package > /dev/null || | |
apm install $pacakge | |
done | |
} | |
apm_lazier_install() { |
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
# directory where aliases are stored | |
export CDP_PATH=~/dotfiles/cdp_symlinks | |
# cdp --add <-- creates an alias of the current direcotry path, named for the current folder name | |
# cdp --add custom-name <-- same as above with custom-name | |
# cdp another-name <-- change into alias | |
# cdp --list <-- see all aliases available to cdp | |
# cdp --remove some-name <-- remove an alias | |
# cd `cdp --path` <-- change into the directory where aliases are stored | |
function cdp { |
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 rand_int { | |
local min=$1 | |
local max=$2 | |
# dd if=/dev/urandom bs=1 count=1 <-- grab a single 1-byte frame from /dev/urandom | |
# | od -An -vtu1 <-- convert raw-binary to a decimal | |
# | tr -d ' ' | tr -d "\n"` <-- trim spaces and line-breaks from output of od (gotta be better way) | |
local randByte=`dd if=/dev/urandom bs=1 count=1 2> /dev/null | od -An -vtu1 | tr -d ' ' | tr -d "\n"` |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>console methods</title> | |
</head> | |
<body> | |
<script> | |
console.assert(1 === true, "assert 1 is strictly equal to true"); | |
console.log({a: "eh", b: "bee"}, [1,2,4,8,16]); |