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
# first install certbot and then run this command on your server | |
# certbot certonly --authenticator standalone --pre-hook "nginx -s stop" --post-hook "nginx" | |
# this will stop for a few seconds your nginx server and generate your Let's Encrypt ssl certificates, and configure | |
# cron so that certificates are renewed automatically \o/ | |
# now create your nginx conf for your nodejs app : | |
# on port 80 (http), redirect to httpS (443) | |
server { | |
if ($host = www.your-domain.com) { |
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 { Field, reduxForm } from "redux-form"; | |
import { TextField, TextArea, SubmitButton } from "./bulma/Form"; | |
let ContactForm = props => { | |
return ( | |
<form onSubmit={props.handleSubmit}> | |
<Field | |
name="name" | |
component={TextField} |
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 { Field, reduxForm } from "redux-form"; | |
import { TextField, TextArea, SubmitButton } from "./bulma/Form"; | |
let ContactForm = props => { | |
return ( | |
<form onSubmit={props.handleSubmit}> | |
<Field | |
name="name" | |
component={TextField} |
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
/** | |
* Can be read like a natural language from top to bottom : | |
* "the function withTodosNull returns a function. If todos is null, | |
* this function return null, else, it return Component | |
*/ | |
function withTodosNull(Component) { | |
return function (props) { | |
if (!props.todos) { | |
return null | |
} |
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 { request, GraphQLClient } from "graphql-request"; | |
export default class HomePage extends React.Component { | |
static async getInitialProps() { | |
const query = `{ | |
allPosts { | |
id | |
slug | |
coverImage { |
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
<!-- | |
On the parent div : | |
display:flex | |
align-items: center; | |
justify-content: center; | |
--> | |
<div style="background: silver; height: 100vh; display:flex; align-items: center;justify-content: center;" class="container"> | |
<div style="background: yellow; height: 20vh">Center me please</div> | |
</div> |
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
# lister les interfaces écoutables | |
tcpdump --list-interfaces | |
# écouter une interface "en0" | |
tcpdump -i en0 | |
# écouter le traffic entrant ou sortant d'une IP en particulier | |
tcpdump host 1.2.3.4 | |
tcpdump src 2.3.4.5 | |
tcpdump dst 3.4.5.6 | |
tcpdump port 80 |
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
handleChange = event => { | |
const target = event.target; | |
const value = target.type === "checkbox" ? target.checked : target.value; | |
const name = target.name; | |
this.setState({ | |
[name]: value | |
}); | |
}; |
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
// destructuring | |
async asyncData({ route }) { | |
console.log(route); | |
} | |
// without destructuring | |
async asyncData(allParams) { | |
console.log(allParams.route); | |
} |
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
// add this line to your preferences | |
"emmet.includeLanguages": { "javascript": "javascriptreact" } |