This file contains hidden or 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
const propTypes = { | |
/** | |
* Change badge color and that of text accordingly | |
*/ | |
color: PropTypes.oneOf(['inverse', 'lightest']), | |
/** | |
* CSS classes that are applied to the span. | |
*/ | |
className: PropTypes.oneOfType([ | |
PropTypes.array, |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Single Page Apps for GitHub Pages</title> | |
<script type="text/javascript"> | |
// Single Page Apps for GitHub Pages | |
// https://github.com/rafrex/spa-github-pages | |
// Copyright (c) 2016 Rafael Pedicini, licensed under the MIT License |
This file contains hidden or 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
# method to get the client IP address | |
def get_client_ip(request): | |
x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR') | |
if x_forwarded_for: | |
ip = x_forwarded_for.split(',')[0] | |
else: | |
ip = request.META.get('REMOTE_ADDR') | |
return ip |
This file contains hidden or 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
... # Other imports | |
import requests | |
import get_client_ip from './utils.py' # See next snippet | |
secret_key = 'YOUR_SECRET_SITE_KEY' # Preferably from settings.py | |
class Submission(APIView): | |
... | |
def post(self, request, *args, **kwargs): |
This file contains hidden or 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
handleSubmit = () => { | |
if(this.state.captcha){ | |
let headers = { | |
'X-CSRFToken': getCookie('csrftoken') | |
} | |
let data = { | |
information: this.state.information, | |
'g-recaptcha-response': this.state["g-recaptcha-response"] | |
} | |
axios.post(urlContactMe(), data, {headers: headers}) |
This file contains hidden or 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
handleCaptcha = (key) => { | |
this.setState({ | |
captcha: true, | |
'g-recaptcha-response': key | |
}) | |
} |
This file contains hidden or 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 ReCAPTCHA from 'react-google-recaptcha' | |
const recaptchaRef = React.createRef() | |
<ReCAPTCHA | |
onChange={this.handleCaptcha} | |
ref={recaptchaRef} | |
//This ref can be used to call captcha related functions in case you need. | |
sitekey="PROVIDE-YOUR_SITE_KEY_HERE" | |
theme="dark" | |
/> |
This file contains hidden or 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
apt-get install git | |
apt-get install sublime-text -y | |
apt install google-chrome-stable -y | |
apt-get install apache2 -y | |
apache2ctl configtest | |
systemctl restart apache2 | |
ufw app list | |
ufw app info "Apache Full" | |
ufw allow in "Apache Full" | |
apt-get install curl -y |