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
// .static/analytics.js | |
!(function(f, b, e, v, n, t, s) { | |
if (f.fbq) return; | |
n = f.fbq = function() { | |
n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments); | |
}; | |
if (!f._fbq) f._fbq = n; | |
n.push = n; | |
n.loaded = !0; |
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
// .pages/_document.js | |
import Document, { Head, Main, NextScript } from "next/document"; | |
export default class MyDocument extends Document { | |
render() { | |
return ( | |
<html> | |
<Head /> | |
<body> |
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 React from "react"; | |
import axios from "axios"; | |
export default class PersonList extends React.Component { | |
state = { | |
persons: [], | |
name: "", | |
id: "" | |
}; |
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
function Blog(props) { | |
const sidebar = ( | |
<ul> | |
{props.posts.map((post) => | |
<li key={post.id}> | |
{post.title} | |
</li> | |
)} | |
</ul> | |
); |
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 numbers = [1, 2, 3, 4, 5]; | |
const listItems = numbers.map((number) => | |
<li>{number}</li> | |
); | |
ReactDOM.render( | |
<ul>{listItems}</ul>, | |
document.getElementById('root') | |
); |
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
function UserGreeting(props) { | |
return <h1>Welcome back!</h1>; | |
} | |
function GuestGreeting(props) { | |
return <h1>Please sign up.</h1>; | |
} | |
function Greeting(props) { | |
const isLoggedIn = props.isLoggedIn; |
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
class EventHandlingDemo extends React.Component { | |
render() { | |
return ( | |
<div> | |
<button onClick={this.handleClick}> | |
ADD | |
</button> | |
<input onChange={this.handleInput}/> | |
{ | |
this.state.todos.map((item) => { |
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
class Clock extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = {date: new Date()}; | |
} | |
componentDidMount() { | |
this.timerID = setInterval( | |
() => this.tick(), | |
1000 |
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
# Create appservice plan named DjangoServicePlan | |
$ az appservice plan create -g DjangoAppRG -n DjangoServicePlan --is-linux --number-of-workers 1 --sku S1 -l westeurope | |
# Create App Service named DjangoDemoAZ | |
$ az webapp create --resource-group DjangoAppRG --plan DjangoServicePlan --name DjangoDemoAZ --runtime "PYTHON|3.7" --deployment-local-git | |
# (optional) Disable ARR DjangoDemoAZ & force HTTPs | |
$ az webapp update --name DjangoDemoAZ --resource-group DjangoAppRG --client-affinity-enabled false --https-only true | |
# (optional) Enable HTTP 2.0, Disable FTP(s) deployment capability and "Always On" mode |
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
# Create resource group named DjangoAppRG | |
$ az group create --name DjangoAppRG --location "West Europe" | |
# Create Azure Database for PostgreSQL server named pgdemoserver | |
$ az postgres server create --resource-group DjangoAppRG --name pgdemoserver --location westeurope --admin-user myadmin --admin-password ThisIs4P4ssw0rd!=1 --sku-name B_Gen5_1 | |
# Allow access to Azure services | |
$ az postgres server firewall-rule create -g DjangoAppRG -s pgdemoserver -n allowall --start-ip-address 0.0.0.0 --end-ip-address 255.255.255.255 | |
# not recommended |