Month: February 2019

  • String to Color – Avatar Helpers

    Hi everyone, A quick post on a helper function I came across for generating avatars. This function generates a random color for the specified string: export const stringToColor = string => { let hash = 0; let i; for (i = 0; i < string.length; i += 1) { hash = string.charCodeAt(i) + ((hash <<…

  • Access to fetch from origin has been blocked by CORS policy – AWS SAM Local

    Hi everyone, I’ve been using AWS SAM local lately and ran into a bit of an issue with CORS. It took a looong time to find a solution that worked for all of my local scenarios so hopefully this will be able to help someone else out. Access to fetch at ‘http://127.0.0.1:3000’ from origin ‘http://localhost:3001’…

  • AWS SAM Request Extremely Slow – Fix

    Hi everyone, I’m currently using AWS SAM CLI with NodeJS and was surprised to find that the requests were significantly slower when run locally. Luckily, I came across a post that suggested adding –skip-pull-image to your start-api command: sam local start-api –skip-pull-image This brought my requests down to under a second. Thanks to the following…

Create a website or blog at WordPress.com