Short-circuit? | Short-circuits on? | Fulfilled on? | Rejected on? | |
---|---|---|---|---|
Promise.all | Yes | First rejected promise | All promise fulfilled | First rejected promise |
Promise.allSettled | No | N/A | Always | N/A |
Promise.race | Yes | First settled | First promise fulfilled | First rejected promise |
Promise.any | Yes | First fulfilled | First promise fulfilled | All rejected promises |
Run the following: | |
iptables -A INPUT -m pkttype --pkt-type multicast -j ACCEPT | |
iptables -A FORWARD -m pkttype --pkt-type multicast -j ACCEPT | |
iptables -A OUTPUT -m pkttype --pkt-type multicast -j ACCEPT | |
Or: | |
iptables -A INPUT -s 224.0.0.0/4 -j ACCEPT | |
iptables -A FORWARD -s 224.0.0.0/4 -d 224.0.0.0/4 -j ACCEPT |
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then | |
// use window.btoa' step. According to my tests, this appears to be a faster approach: | |
// http://jsperf.com/encoding-xhr-image-data/5 | |
/* | |
MIT LICENSE | |
Copyright 2011 Jon Leighton | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
/** | |
* After some thoughts on this topic, I've decided to turn this gist along with other features into a library so you can zoom | |
* whatever you want, library you can find here https://github.com/Glazzes/react-native-zoom-toolkit. | |
* | |
* @author Santiago Zapata, Glazzes at Github <3 | |
* @description This gist makes part of an article I'm writing about this topic (in spanish). This solution takes into account | |
* the linear algebra concepts and geometrical interpretation of the transform-origin property specification, this solution | |
* takes heavy inspiration from William's Candillon +3 year old video in this topic, however this solution brings it to the | |
* modern day along with a huge fix that prevents the origin from being displaced by an incorrect offset calculation after | |
* the first zoom interaction. |
const highlight = (fuseSearchResult: any, highlightClassName: string = 'highlight') => { | |
const set = (obj: object, path: string, value: any) => { | |
const pathValue = path.split('.'); | |
let i; | |
for (i = 0; i < pathValue.length - 1; i++) { | |
obj = obj[pathValue[i]]; | |
} | |
obj[pathValue[i]] = value; |
import Amplify from '@aws-amplify/core' | |
import config from './aws-exports' | |
Amplify.configure(config) | |
import React, { useState, useEffect } from 'react' | |
import { Text, View, TextInput, Button } from 'react-native' | |
import { DataStore } from '@aws-amplify/datastore' | |
import { Message} from './src/models' | |
const initialState = { color: 'black', title: '' } |
To view and deploy the app covered in this chapter, check out this repo.
So far in this book we've worked with both REST APIs and GraphQL APIs. When working with the GraphQL APIs so far, we've used the API class to directly call mutations and queries against the API.
Amplify also supports another type of API for interacting with AppSync, Amplify DataStore. DataStore has a different approach than a traditional GraphQL API.
Instead of interacting with the GraphQL API itself using queries and mutations, DataStore introduces a client-side SDK that persists the data locally using the local storage engine of the platform you are working with (i.e. IndexDB for web, SQLLite for native iOS and Android). DataStore then automatically syncs the local data to the GraphQL backend for you as updates are made both locally and remotely.
import React from 'react'; | |
import { StyleSheet, Text, View, TextInput, Button } from 'react-native'; | |
import Amplify from '@aws-amplify/core' | |
import config from './aws-exports' | |
Amplify.configure(config) | |
import API, { graphqlOperation } from '@aws-amplify/api' | |
const listPets = ` |
/*--- waitForKeyElements(): A utility function, for Greasemonkey scripts, | |
that detects and handles AJAXed content. | |
Usage example: | |
waitForKeyElements ( | |
"div.comments" | |
, commentCallbackFunction | |
); |
/*{ | |
"name": "Local see Package", | |
"id": "self.private.me.local.see", | |
"version": 1, | |
"classPath": "localSee.LocalSeeProviderPackage" | |
} | |
*/ | |
/** | |
* Your package js file must contain a manifest declaration at the very beginning of the file. |