This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.
Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).
// helps us in parsing the frontmatter from text content | |
const matter = require('gray-matter') | |
// helps us safely stringigy the frontmatter as a json object | |
const stringifyObject = require('stringify-object') | |
// helps us in getting the reading time for a given text | |
const readingTime = require('reading-time') | |
// please make sure you have installed these dependencies | |
// before proceeding further, or remove the require statements | |
// that you don't use |
import { useRef, useEffect } from 'react'; | |
/** | |
* a type-safe version of the `usePrevious` hook described here: | |
* @see {@link https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state} | |
*/ | |
export function usePrevious<T>( | |
value: T, | |
): ReturnType<typeof useRef<T>>['current'] { | |
const ref = useRef<T>(); |
import { combineReducers } from 'redux'; | |
import AppReducer from './AppReducer'; | |
import UsersReducer from './UsersReducer'; | |
import OrderReducer from './OrderReducer'; | |
import NotificationReducer from './NotificationReducer'; | |
import CommentReducer from './CommentReducer'; | |
const appReducer = combineReducers({ | |
/* your app’s top-level reducers */ |
import React from 'react'; | |
import { NetworkProvider } from './NetworkProvider'; | |
import { ExampleComponent } from './ExampleComponent'; | |
export default class App extends React.PureComponent { | |
render() { | |
return ( | |
<NetworkProvider> | |
<ExampleComponent /> |
This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.
Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).
import React, {Component} from 'react'; | |
import {TextInput, View, Keyboard} from 'react-native'; | |
import {Constants, Notifications, Permissions} from 'expo'; | |
export default class Timer extends Component { | |
onSubmit(e) { | |
Keyboard.dismiss(); | |
const localNotification = { | |
title: 'done', |
// Deep Equality comparison example | |
// | |
// This is an example of how to implement an object-comparison function in | |
// JavaScript (ES5+). A few points of interest here: | |
// | |
// * You can get an array of all an object's properties in ES5+ by calling | |
// the class method Object.keys(obj). | |
// * The function recursively calls itself in the for / in loop when it | |
// compares the contents of each property | |
// * You can hide a "private" function inside a function of this kind by |
const curry = fn => (...args) => fn.bind(null, ...args); | |
const map = curry((fn, arr) => arr.map(fn)); | |
const join = curry((str, arr) => arr.join(str)); | |
const toLowerCase = str => str.toLowerCase(); | |
const split = curry((splitOn, str) => str.split(splitOn)); |
/** | |
Taken from: http://stackoverflow.com/questions/588040/window-onload-vs-document-onload | |
According to Parsing HTML documents - The end, | |
The browser parses the HTML source and runs deferred scripts. | |
A DOMContentLoaded is dispatched at the document when all the HTML has been parsed and have run. The event bubbles to the window. | |
The browser loads resources (like images) that delay the load event. | |
A load event is dispatched at the window. | |
Therefore, the order of execution will be | |
DOMContentLoaded event listeners of window in the capture phase | |
DOMContentLoaded event listeners of document |
{ fontWeight: '100' }, // Thin | |
{ fontWeight: '200' }, // Ultra Light | |
{ fontWeight: '300' }, // Light | |
{ fontWeight: '400' }, // Regular | |
{ fontWeight: '500' }, // Medium | |
{ fontWeight: '600' }, // Semibold | |
{ fontWeight: '700' }, // Bold | |
{ fontWeight: '800' }, // Heavy | |
{ fontWeight: '900' }, // Black |