- The person you are assisting is User.
- Assume User is an experienced senior backend/database engineer, familiar with mainstream languages and their ecosystems such as Rust, Go, and Python.
- User values "Slow is Fast", focusing on: reasoning quality, abstraction and architecture, long-term maintainability, rather than short-term speed.
- Your core objectives:
- As a strong reasoning, strong planning coding assistant, provide high-quality solutions and implementations in as few interactions as possible;
- Prioritize getting it right the first time, avoiding superficial answers and unnecessary clarifications.
| class Spiderman { | |
| lookOut() { | |
| alert('My Spider-Sense is tingling.'); | |
| } | |
| } | |
| let miles = new Spiderman(); | |
| miles.lookOut(); |
| #include <stdint.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| // munged from https://github.com/simontime/Resead | |
| namespace sead | |
| { | |
| class Random | |
| { |
| 'use strict'; | |
| /** | |
| * Lambda@Edge to log CloudFront event and context. | |
| * Note: this runs in Lambda@Edge which means it runs in a variety | |
| * of regions, the region closest to the browser making the request. | |
| * So be sure and check other regions if you don't see the logs in | |
| * CloudWatch in the region you normally use. | |
| * | |
| * https://medium.com/@jbesw/postcards-from-lambda-the-edge-11a43f215dc1 |
| "use strict"; | |
| // Load plugins | |
| const autoprefixer = require("autoprefixer"); | |
| const browsersync = require("browser-sync").create(); | |
| const cp = require("child_process"); | |
| const cssnano = require("cssnano"); | |
| const del = require("del"); | |
| const eslint = require("gulp-eslint"); | |
| const gulp = require("gulp"); |
Feel free to contact me at robert.balicki@gmail.com or tweet at me @statisticsftw
This is a rough outline of how we utilize next.js and S3/Cloudfront. Hope it helps!
It assumes some knowledge of AWS.
| // https://github.com/alfonsomunozpomer/react-fetch-mock | |
| import React from 'react' | |
| import fetchMock from 'fetch-mock' | |
| import Enzyme from 'enzyme' | |
| import {shallow, mount, render} from 'enzyme' | |
| import Adapter from 'enzyme-adapter-react-16' | |
| Enzyme.configure({ adapter: new Adapter() }) |
Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the first resource was served. This is set on the server-side and there is nothing you can do from the client-side to change that setting, that is up to the server/API. There are some ways to get around it tho.
Sources : MDN - HTTP Access Control | Wiki - CORS
CORS is set server-side by supplying each request with additional headers which allow requests to be requested outside of the own domain, for example to your localhost. This is primarily set by the header:
Access-Control-Allow-Origin- Amex Card:
^3[47][0-9]{13}$ - BCGlobal:
^(6541|6556)[0-9]{12}$ - Carte Blanche Card:
^389[0-9]{11}$ - Diners Club Card:
^3(?:0[0-5]|[68][0-9])[0-9]{11}$ - Discover Card:
^65[4-9][0-9]{13}|64[4-9][0-9]{13}|6011[0-9]{12}|(622(?:12[6-9]|1[3-9][0-9]|[2-8][0-9][0-9]|9[01][0-9]|92[0-5])[0-9]{10})$ - Insta Payment Card:
^63[7-9][0-9]{13}$ - JCB Card:
^(?:2131|1800|35\d{3})\d{11}$ - KoreanLocalCard:
^9[0-9]{15}$