sudo apt-get install python3-pip
sudo pip3 install virtualenv
| from celery import Task | |
| from celery.task import task | |
| from my_app.models import FailedTask | |
| from django.db import models | |
| @task(base=LogErrorsTask) | |
| def some task(): | |
| return result | |
| class LogErrorsTask(Task): |
| <?php | |
| // See: http://blog.ircmaxell.com/2013/02/preventing-csrf-attacks.html | |
| // Start a session (which should use cookies over HTTP only). | |
| session_start(); | |
| // Create a new CSRF token. | |
| if (! isset($_SESSION['csrf_token'])) { | |
| $_SESSION['csrf_token'] = base64_encode(openssl_random_pseudo_bytes(32)); | |
| } |
| Disclaimer: The instructions are the collective efforts from a few places online. | |
| Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did. | |
| First off, bundle. | |
| ================== | |
| 1. cd to the project directory | |
| 2. Start the react-native packager if not started | |
| 3. Download the bundle to the asset folder: | |
| curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle" |
| <?php | |
| function require_auth() { | |
| $AUTH_USER = 'admin'; | |
| $AUTH_PASS = 'admin'; | |
| header('Cache-Control: no-cache, must-revalidate, max-age=0'); | |
| $has_supplied_credentials = !(empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['PHP_AUTH_PW'])); | |
| $is_not_authenticated = ( | |
| !$has_supplied_credentials || | |
| $_SERVER['PHP_AUTH_USER'] != $AUTH_USER || | |
| $_SERVER['PHP_AUTH_PW'] != $AUTH_PASS |
| import React, { Component } from 'react' | |
| import { Redirect } from 'react-router' | |
| export default class ContactForm extends Component { | |
| constructor () { | |
| super(); | |
| this.state = { | |
| fireRedirect: false | |
| } | |
| } |