Skip to content

Instantly share code, notes, and snippets.

View dezren39's full-sized avatar
🕵️‍♂️
Processing..

Drewry Pope dezren39

🕵️‍♂️
Processing..
View GitHub Profile
@dezren39
dezren39 / Links.csv
Created November 6, 2020 00:08 — forked from ptrelford/Links.csv
Mystic Brew
@dezren39
dezren39 / 01-directory-structure.md
Created July 20, 2020 16:37 — forked from tracker1/01-directory-structure.md
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
@dezren39
dezren39 / babel-webpack.md
Created July 6, 2020 05:42 — forked from ncochard/babel-webpack.md
The correct way to compile ES6 using babel...

When you create a npm package, remember it might be used in a browser or a server, or even a command line utility… For each package you create, please pay attention at what it will be used for:

  1. Is it going to be used as a dependency to a nodejs application that is not bundled? (e.g. command line utilities)
  2. Is it going to be used as a dependency to a nodejs application that is bundled? (e.g. AWS Lambdas)
  3. Is it going to be used as a dependency to a browser application (always bundled)?.
  • In cases 2) and 3) you want to allow for tree shaking.
  • In cases 1) and 2) you want to benefit from the "ES6"/"ES next" features supported natively by nodejs.
  • In case 3) you also want to benefit from the native support of "ES6" from your browser.
@dezren39
dezren39 / 1.generate_dockerignore.py
Created July 5, 2020 16:37 — forked from wassname/1.generate_dockerignore.py
Convert .gitignore to .dockerignore: quick and dirty.
"""
Convert .gitignore to .dockerignore: quick and dirty.
This is a quick and dirty script to convert this:
`__pycache__/`
Into this:
```
__pycache__
*/__pycache__
@dezren39
dezren39 / get-npm-package-version
Last active November 28, 2022 16:30 — forked from DarrenN/get-npm-package-version
Extract version from package.json (NPM) using bash / shell
# these can all be npm scripts, but anything can be an npm script
# a
echo $(cat ./package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')
# b
echo $(cat ./package.json | grep version | head -1 | awk -F= "{ print $2 }" | sed -E 's/(version)|[:,\",]//g' | tr -d '[[:space:]]')
# c
echo $(node --eval="process.stdout.write(require('./package.json').version)")
@dezren39
dezren39 / get-npm-package-version
Created July 5, 2020 12:35 — forked from yvele/get-npm-package-version.sh
Extract version from package.json (NPM) using bash / shell
# 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' \
| tr -d '[[:space:]]')
echo $PACKAGE_VERSION
@dezren39
dezren39 / unfollow.js
Created January 3, 2020 13:18 — forked from JamieMason/unfollow.js.md
Unfollow everyone on twitter.com
// Unfollow everyone on twitter.com, by Jamie Mason (https://twitter.com/fold_left)
// https://gist.github.com/JamieMason/7580315
//
// 1. Go to https://twitter.com/YOUR_USER_NAME/following
// 2. Open the Developer Console. (COMMAND+ALT+I on Mac)
// 3. Paste this into the Developer Console and run it
(() => {
const followButtonQuery = '[data-testid$="-unfollow"]';
const confirmButtonQuery = '[data-testid="confirmationSheetConfirm"]';
const sleep = ({ seconds }) =>
@dezren39
dezren39 / Dockerfile
Created September 5, 2019 06:56 — forked from armand1m/Dockerfile
Yarn cache compatible Dockerfile
FROM alpine
RUN apk add --update --no-cache nodejs
RUN npm i -g yarn
ADD package.json yarn.lock /tmp/
ADD .yarn-cache.tgz /
RUN cd /tmp && yarn
RUN mkdir -p /service && cd /service && ln -s /tmp/node_modules
@dezren39
dezren39 / hb_all_books_dl.js
Created May 4, 2019 07:28 — forked from fsteffek/hb_all_books_dl.js
Humble bundle book bundles - download all books and md5sums
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
*/
function getTitle() {
var re = /^Humble\ Book\ Bundle\:\ (.*)\ \(/g;
return re.exec(document.title)[1];
}
@dezren39
dezren39 / hb_all_books_dl.js
Created May 4, 2019 07:28 — forked from graymouser/hb_all_books_dl.js
Humble bundle book bundles - download all books at once
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
*/
$('a').each(function(i){
if ($.trim($(this).text()) == 'MOBI') {
$('body').append('<iframe id="dl_iframe_'+i+'" style="display:none;">');
document.getElementById('dl_iframe_'+i).src = $(this).data('web');
}
});