Related links:
- Enable SSL in Apache for 'localhost' (OSX, El Capitan)
- https://wiki.recallinfolink.us/index.php?title=Dev:Setting_up_a_Windows_10_Development_Environment
- https://wiki.recallinfolink.us/index.php?title=Dev:Create_self-signed_certificate_with_SAN
- Uncomment vhost and ssl lines in httpd.conf:
🚨 2020 Update: I recommend using mkcert to generate local certificates. You can do everything below by just running the commands brew install mkcert
and mkcert -install
. Keep it simple!
This gives you that beautiful green lock in Chrome. I'm assuming you're putting your SSL documents in /etc/ssl
, but you can put them anywhere and replace the references in the following commands. Tested successfully on Mac OS Sierra and High Sierra.
sudo nano /etc/ssl/localhost/localhost.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am devakone on github. | |
* I am devakone (https://keybase.io/devakone) on keybase. | |
* I have a public key ASByeWTO9FcHZlpWp9J328OC_vGki2s2h97qmH9JJSKf_Qo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dompurify from 'dompurify'; | |
import useTranslateHtmlElement from './use-translate-html-element'; | |
// Our safe HTML rendering component | |
// From https://dev.to/jam3/how-to-prevent-xss-attacks-when-using-dangerouslysetinnerhtml-in-react-1464 | |
function SafeHTMLComponent() { | |
// title is dynamic HTML | |
const title = response.from.backend.title; | |
// sanitizer will sanitize the HTML | |
const sanitizer = dompurify.sanitize; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
<Formik component={ContactForm} />; | |
... | |
import useTranslateFormErrors from '../../hooks/use-translate-form-errors'; | |
const ContactForm = ({ | |
handleSubmit, | |
handleChange, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Formik | |
render={({ handleSubmit, handleChange, handleBlur, setFieldTouched, values, errors, touched }) => ( | |
<WithTranslateFormErrors errors={errors} touched={touched} setFieldTouched={setFieldTouched}> | |
<form onSubmit={handleSubmit}> | |
<input | |
type="text" | |
onChange={handleChange} | |
onBlur={handleBlur} | |
value={values.name} | |
name="name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Formik | |
render={({ handleSubmit, handleChange, handleBlur, setFieldTouched, values, errors, touched }) => ( | |
<WithTranslateFormErrors errors={errors} touched={touched} setFieldTouched={setFieldTouched}> | |
<form onSubmit={handleSubmit}> | |
<input | |
type="text" | |
onChange={handleChange} | |
onBlur={handleBlur} | |
value={values.name} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect } from 'react'; | |
import { useTranslation } from 'react-i18next'; | |
// When change language is triggered, re-validate the form as to get all errors translated | |
// the parameters here are part of the FormikProps<Values> render props | |
// https://jaredpalmer.com/formik/docs/api/formik#formik-render-methods-and-props | |
const useTranslateFormErrors = (errors, touched, setFieldTouched) => { | |
const { i18n } = useTranslation(); | |
useEffect(() => { | |
i18n.on('languageChanged', lng => { |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
NewerOlder