Skip to content

Category Archives: Web Development

JavaScript: get domain from url with JS regex

07-Nov-18

It's as simple as url.match(/\/\/(.[^/]+)/)[1]. Requires the double slash before the domain part, but not a slash after it.

Bootstrap 3 text-align (left/right) for xs, sm, md, lg screen sizes

02-Nov-18

/** * Text alignment for screen sizes */ @media (max-width:767px){ .xs-text-right { text-align: right; } .xs-text-left { text-align: left; } } @media (min-width:768px){ .sm-text-right { text-align: right; } .sm-text-left { text-align: left; } } @media (min-width:992px){ .md-text-right { text-align: right; } .md-text-left { text-align: left; } } @media (min-width:1200px){ .lg-text-right { text-align: right; } .lg-text-left […]

ESLint disable rule for the whole file: /* eslint-disable */

31-Oct-18

While rules can be disabled for a line with // eslint-disable-line [rule-name] the whole file disabling needs block comments: /* eslint-disable [rule-name] */

Conflicting package-lock.json in Git?

30-Oct-18

Include package-lock.json in your git repository, but try to commit it alone (to avoid noise in diffs). When encountering conflicts during merge: npm install --package-lock-only As running that command then suggests, you might also want to consider automating the process by installing npm-merge-driver (npx npm-merge-driver install -g).

Cancel Conflicting Git Merge (--ABORT)

30-Oct-18

Your keyword here is abort. git merge --abort