sudo apt-get install python3-pip
sudo pip3 install virtualenv
import React, { Component } from 'react' | |
import { Redirect } from 'react-router' | |
export default class ContactForm extends Component { | |
constructor () { | |
super(); | |
this.state = { | |
fireRedirect: false | |
} | |
} |
<?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 |
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 | |
// 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)); | |
} |
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): |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": "*", | |
"Action": [ | |
"s3:ListBucket", | |
"s3:GetBucketLocation" | |
], |
brew install pyenv | |
pyenv install 3.7.3 | |
pyenv global 3.7.3 | |
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc | |
source .zshrc |
import 'dart:math'; | |
import 'package:flutter/material.dart'; | |
const CURVE_HEIGHT = 250.0; | |
const AVATAR_RADIUS = CURVE_HEIGHT * 0.28; | |
const AVATAR_DIAMETER = AVATAR_RADIUS * 2; | |
class TopCurvePainter extends CustomPainter { |
import 'dart:math'; | |
import 'package:flutter/material.dart'; | |
const CURVE_HEIGHT = 250.0; | |
const AVATAR_RADIUS = CURVE_HEIGHT * 0.28; | |
const AVATAR_DIAMETER = AVATAR_RADIUS * 2; | |
class BottomCurvePainter extends CustomPainter { | |
@override |