| Method | Side effects1 | State updates2 | Example uses |
|---|---|---|---|
| Mounting | |||
componentWillMount |
✓ | Constructor equivalent for createClass |
|
render |
Create and return element(s) | ||
componentDidMount |
✓ | ✓ | DOM manipulations, network requests, etc. |
| Updating | |||
componentWillReceiveProps |
✓ | Update state based on changed props |
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
| <html> | |
| <head> | |
| <script is:inline defer src="https://cdn.jsdelivr.net/npm/img-comparison-slider@8/dist/index.js"></script> | |
| <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/img-comparison-slider@8/dist/styles.css" /> | |
| <style> | |
| .slider { | |
| width: 70%; |
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
| 'use strict' | |
| // examples from https://github.com/vriad/zod | |
| // trying to use zod in JS w/ jsdoc type comments in vsCode | |
| const z = require('zod') | |
| const dogSchema = z.object({ | |
| name: z.string(), |
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
| #!/bin/sh | |
| wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-arm.zip | |
| unzip ngrok.zip | |
| ./ngrok authtoken [YOUR_TOKEN] |
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 PropTypes from 'prop-types' | |
| import Box from '../Box' | |
| import { cloneChildren, joinChildren } from '../utils' | |
| const BASELINE = 'baseline' | |
| const CENTER = 'center' | |
| const END = 'end' | |
| const FILL = 'fill' |
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 a group | |
| CREATE ROLE readaccess; | |
| -- Grant access to existing tables | |
| GRANT USAGE ON SCHEMA public TO readaccess; | |
| GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess; | |
| -- Grant access to future tables | |
| ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess; |
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
| // Here is a function that I use all the time when creating public | |
| // async APIs in JavaScript: | |
| const resolvePromise = (promise, callback) => { | |
| if (callback) | |
| promise.then(value => callback(null, value), callback) | |
| return promise | |
| } | |
| // Sometimes I like to use callbacks, but other times a promise is |
type below:
brew update
brew install redis
To have launchd start redis now and restart at login:
brew services start redis
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>Add to Homescreen</title> | |
| <meta name="apple-mobile-web-app-capable" content="yes"> | |
| <meta name="apple-mobile-web-app-title" content="Test name 2"> |
A complete list of RxJS 5 operators with easy to understand explanations and runnable examples.
NewerOlder