Helpful Migration Guides:
| export default class Article extends Component { | |
| // notice that it's an async function | |
| static async getInitialProps () { | |
| // fetch data on the server and parse it to JSON | |
| const res = await | |
| fetch('http://localhost:3000/wp-json/wp/v2/articles/1316999'); | |
| const json = await res.json(); |
| const fetch = require('node-fetch') | |
| const crypto = require('crypto') | |
| const path = require('path') | |
| const fs = require('fs'); | |
| const _ = require('lodash'); | |
| exports.sourceNodes = async ({ actions }) => { | |
| const { createNode } = actions | |
| const createProduct = (var1, var2) => { |
| var Promise = require('bluebird'); | |
| var sinon = require('sinon'); | |
| var User = require('./db/models').User; | |
| describe('User model', function(){ | |
| var userFindStub; | |
| var sandbox; | |
| before(function(){ | |
| sandbox = sinon.sandbox.create(); |
| axios({ | |
| url: 'http://localhost:5000/static/example.pdf', | |
| method: 'GET', | |
| responseType: 'blob', // important | |
| }).then((response) => { | |
| const url = window.URL.createObjectURL(new Blob([response.data])); | |
| const link = document.createElement('a'); | |
| link.href = url; | |
| link.setAttribute('download', 'file.pdf'); | |
| document.body.appendChild(link); |
| import RNFS from 'react-native-fs'; | |
| module.exports = { | |
| read: (source) => | |
| { | |
| return RNFS.exists(source).then((fileExists) => | |
| { | |
| if (fileExists) | |
| { | |
| return RNFS.readFile(source).then((data) => JSON.parse(data)); |
FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.
- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/
Prerequisites : the letsencrypt CLI tool
This method allows your to generate and renew your Lets Encrypt certificates with 1 command. This is easily automatable to renew each 60 days, as advised.
You need nginx to answer on port 80 on all the domains you want a certificate for. Then you need to serve the challenge used by letsencrypt on /.well-known/acme-challenge.
Then we invoke the letsencrypt command, telling the tool to write the challenge files in the directory we used as a root in the nginx configuration.
I redirect all HTTP requests on HTTPS, so my nginx config looks like :
server {