Skip to content

Instantly share code, notes, and snippets.

@mr-beerkiss
mr-beerkiss / fetchData.js
Created October 13, 2017 07:26
Fetch Example
// I find MDN have the best resources for most JS stuff: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
// using async/await
(async function() {
// when using await, the function in the outer scope must be declared `async` otherwise it won't work and
// you'll get very mysterious error messages
try {
const response = await fetch('some/url');
// response.ok is generally a status code between 200 & 299
if (response.ok) {
let data;
@mr-beerkiss
mr-beerkiss / s3-bucket-name-generator.js
Created July 9, 2017 21:14
Utility to generate meaningful, unique S3 bucket names
// Requires Node 8
// Usage node index.js your-bucket-name
const promisify = require("util").promisify;
const shasum = require("shasum");
const randomBytes = promisify(require("crypto").randomBytes);
(async () => {
try {

Keybase proof

I hereby claim:

  • I am mr-beerkiss on github.
  • I am mr_beerkiss (https://keybase.io/mr_beerkiss) on keybase.
  • I have a public key whose fingerprint is 69BB B155 19D2 9DFF 1E54 96D9 F7FB 32DB 35C9 B37C

To claim this, I am signing this object:

@mr-beerkiss
mr-beerkiss / readme.md
Created July 13, 2016 15:47 — forked from vbence86/readme.md
Release Smash-website to Development
@mr-beerkiss
mr-beerkiss / webpack.js
Created November 24, 2015 15:35 — forked from Couto/webpack.js
Fetch polyfill with webpack
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var folders = {
APP: path.resolve(__dirname, '../app'),
BUILD: path.resolve(__dirname, '../build'),
BOWER: path.resolve(__dirname, '../bower_components'),
NPM: path.resolve(__dirname, '../node_modules')
};