Skip to content

Instantly share code, notes, and snippets.

View heypano's full-sized avatar

Pano Papadatos heypano

View GitHub Profile
@zulhfreelancer
zulhfreelancer / README.md
Created May 15, 2019 04:46
S3 Website + CloudFront - how to show index.html content when at /sub-directory/ path?

Problem

We have index.html file in S3 bucket under a folder called /about-us/. When checking in browser using CloudFront distribution link, custom-domain.com/about-us/ shows AccessDenied error.

But, custom-domain.com/about-us/index.html works fine and show content.

What we want

We want custom-domain.com/about-us/ to show the index.html content.

@adccb
adccb / switch.js
Created March 20, 2018 16:07
switch nonsense
const someVar = 'foo'
// the bad way
switch(someVar) {
case foo:
const response = 'someVar is foo!'
break
case bar:
const response = 'someVar is bar!' // errors, 'assigning to constant variable response'
@zcaceres
zcaceres / Eyeballing-This.md
Last active August 17, 2023 23:38
Understanding Binding and 'this' in Javascript by zach.dev

How to Eyeball Your ‘This’ Context in Javascript

The early programmer struggles with the Javascript keyword this. But understanding your this context is easier than it seems.

This is all about where a function is invoked. Often, early programmers worry about where the function was declared. Perhaps the function was declared in a specific file or a particular object. Surely this changes it's this!

Nope.