Skip to content

Instantly share code, notes, and snippets.

@xx4159
xx4159 / version.sh
Created Jan 10, 2020 — forked from DarrenN/get-npm-package-version
Extract version from package.json (NPM) using bash / shell
View version.sh
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION
@xx4159
xx4159 / uri.js
Created May 2, 2019 — forked from jlong/uri.js
URI Parsing with Javascript
View uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
You can’t perform that action at this time.