This content moved here: https://exploringjs.com/impatient-js/ch_arrays.html#quickref-arrays
| #! /bin/bash | |
| # The Purpose of this Script is to batch convert and compress any video file to mp4 format | |
| # | |
| # WARNING: LOSSY COMPRESSION !!! | |
| # Variable used: | |
| # sourcedir is the directory where to be converted videos are. Converted video will be saved in the same folder | |
| # usage: |
| import React, { PureComponent } from 'react'; | |
| import { View, Text, NetInfo, Dimensions, StyleSheet } from 'react-native'; | |
| const { width } = Dimensions.get('window'); | |
| function MiniOfflineSign() { | |
| return ( | |
| <View style={styles.offlineContainer}> | |
| <Text style={styles.offlineText}>No Internet Connection</Text> | |
| </View> |
| const puppeteer = require('puppeteer'); | |
| const firebase = require('firebase'); | |
| if(!firebase.apps.length) { | |
| let config = { | |
| apiKey: "xxxxxxxxxxxxxxxxxxxxx", | |
| authDomain: "xxxxxxxxxxxxxxxxxxxxxxxx", | |
| databaseURL: "xxxxxxxxxxxxxxxxxxxxx", | |
| projectId: "xxxxxxxxx", | |
| storageBucket: "xxxxxxxxxxxxxxxxxxxx", |
| require("dotenv").config(); // read .env file if present. | |
| const nodemailer = require("nodemailer"); | |
| const createHtmlMail = require("./modules/mail-template"); // this function returns html email code | |
| exports.handler = function(event, context, callback) { | |
| const user = process.env.MAIL_USER; // some@mail.com | |
| const pass = process.env.MAIL_PASSWORD; // 42isthecoolestnumber | |
| let transporter = nodemailer.createTransport({ |
| const fs = require('fs'); | |
| const nodemailer = require('nodemailer'); | |
| const sendmail = (todaydate) => { | |
| let filename = `geckoboard_${todaydate}.jpg`; | |
| nodemailer.createTestAccount((err, account) => { | |
| let transporter = nodemailer.createTransport({ | |
| host: env.EMAIL_HOST, // smtp host | |
| port: 25, |
| const puppeteer = require('puppeteer'); | |
| const PUPPETEER_OPTIONS = { | |
| headless: true, | |
| args: [ | |
| '--disable-gpu', | |
| '--disable-dev-shm-usage', | |
| '--disable-setuid-sandbox', | |
| '--timeout=30000', | |
| '--no-first-run', |
The [React docs][condoc] give some example use cases for context:
Context is designed to share data that can be considered “global” for a tree of React components, such as the current authenticated user, theme, or preferred language.
The common property of these use cases is that data like the current theme doesn't change often and needs to be shared deep down the component tree, which would be cumbersome with "[prop drilling][drill]". Something else that needs to be shared everywhere is the application state when using a "single source of truth" pattern, so it would follow that the context API would help with that as well, but there's a catch: components that use context will rerender every time that the provided value changes, so sharing the whole application state through context would cause excessive render lifecycles.