- Install ffmpeg using homebrew:
brew install ffmpeg- convert the file:
brew install ffmpeg| // array , property string | |
| // https://medium.com/javascript-inside/safely-accessing-deeply-nested-values-in-javascript-99bf72a0855a | |
| const get = (p, o) => | |
| p.reduce((xs, x) => (xs && xs[x]) ? xs[x] : null, o) | |
| // let's pass in our props object... | |
| console.log(get(['user', 'posts', 0, 'comments'], props)) | |
| // [ 'Good one!', 'Interesting...' ] | |
| console.log(get(['user', 'post', 0, 'comments'], props)) | |
| // null |
| import React from "react"; | |
| import PropTypes from "prop-types"; | |
| import Chip from "material-ui/Chip"; | |
| import { withStyles } from "material-ui/styles"; | |
| const styles = theme => ({ | |
| root: { | |
| display: "flex", | |
| flexWrap: "wrap" | |
| }, |
| import React from "react"; | |
| import PropTypes from "prop-types"; | |
| import Chip from "material-ui/Chip"; | |
| import { withStyles } from "material-ui/styles"; | |
| const styles = theme => ({ | |
| root: { | |
| display: "flex", | |
| flexWrap: "wrap" | |
| }, |
| class ImageUpload extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| file: '', | |
| imagePreviewUrl: '' | |
| }; | |
| this._handleImageChange = this._handleImageChange.bind(this); | |
| this._handleSubmit = this._handleSubmit.bind(this); | |
| } |
| <?php | |
| // tried this today, 31 May 2011 | |
| echo "\n"; | |
| echo date('Y-m-d', strtotime('first day of next month')); // correct | |
| echo "\n"; | |
| echo date('Y-m-d', strtotime('+1 month')); // wrong! output is 2011-07-01 | |
| echo "\n"; |
| [Unit] | |
| Description=MongoDB Database Service | |
| Wants=network.target | |
| After=network.target | |
| [Service] | |
| Type=simple | |
| PermissionsStartOnly=true | |
| ExecStartPre=/bin/mkdir -p /var/lib/mongodb | |
| ExecStartPre=/bin/chown mongodb:mongodb /var/lib/mongodb |
| [Unit] | |
| Description=MongoDB Database Service | |
| Wants=network.target | |
| After=network.target | |
| [Service] | |
| Type=forking | |
| PIDFile=/var/run/mongodb/mongod.pid | |
| ExecStart=/usr/local/bin/mongod --config /etc/mongod.conf | |
| ExecReload=/bin/kill -HUP $MAINPID |
| Immutable Update Cheat Sheet / Receipes | |
| Objects | |
| Updating object property | |
| // Alternative #1 | |
| return {...originalObject, existingPropertyKey: newValue }; | |
| // Alternative #2 | |
| return Object.assign({}, originalObject, { existingPropertyKey: newValue }); // Notice extra { } around properties | |
| Updating nested object property | |
| For nested fields you need to remember to copy every level, read more here. |
| function post_to_url($url, $data) { | |
| $fields = ''; | |
| foreach($data as $key => $value) { | |
| $fields .= $key . '=' . $value . '&'; | |
| } | |
| rtrim($fields, '&'); | |
| $post = curl_init(); | |
| curl_setopt($post, CURLOPT_URL, $url); |