How to use packages that depend on Node.js core modules in React Native.
See the [node-libs-react-native][node-libs-react-native] library as a convenience for implementing this method.
| #!/usr/bin/env python | |
| """ Video stabilization with OpenCV (>=2.3) and Hugin | |
| Adrien Gaidon | |
| INRIA - 2012 | |
| TODO: add cropping, clean-up and improve doc-strings | |
| """ |
| from __future__ import division | |
| import cv2 | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import os | |
| os.chdir('C:/Users/gennady.nikitin/Dropbox/Coding/OpenCV') | |
| # define variable for resize tratio | |
| ratio = 1 |
| # Based on this answer: https://stackoverflow.com/a/61859561/1956278 | |
| # Backup old data | |
| Rename-Item -Path "./data" -NewName "./data_old" | |
| # Create new data directory | |
| Copy-Item -Path "./backup" -Destination "./data" -Recurse | |
| Remove-Item "./data/test" -Recurse | |
| $dbPaths = Get-ChildItem -Path "./data_old" -Exclude ('mysql', 'performance_schema', 'phpmyadmin') -Recurse -Directory | |
| Copy-Item -Path $dbPaths.FullName -Destination "./data" -Recurse |
| const AWS = require('aws-sdk'); | |
| const {parallelScan} = require('@shelf/dynamodb-parallel-scan'); | |
| const TABLE_NAME = '[table-name]'; | |
| const PRIMARY_PARTITION_KEY = '[partition-key]'; | |
| async function fetchAll() { | |
| const CONCURRENCY = 250; | |
| const alias = `#${PRIMARY_PARTITION_KEY}`; | |
| const name = PRIMARY_PARTITION_KEY; |
| Enterprise: NJVYC-BMHX2-G77MM-4XJMR-6Q8QF | |
| Professional: KBJFW-NXHK6-W4WJM-CRMQB-G3CDH | |
| Keys are generic ones. These are the same from MSDN account. | |
| Product Key : -6Q8QF | |
| Validity : Valid | |
| Product ID : 00369-90000-00000-AA703 | |
| Advanced ID : XXXXX-03699-000-000000-00-1032-9200.0000-0672017 |
| // Simple gist to test parallel promise resolution when using async / await | |
| function promiseWait(time) { | |
| return new Promise((resolve, reject) => { | |
| setTimeout(() => { | |
| resolve(true); | |
| }, time); | |
| }); | |
| } |
| const delay = ms => new Promise(resolve => setTimeout(resolve, ms)); | |
| async function something() { | |
| console.log("this might take some time...."); | |
| await delay(5000); | |
| console.log("done!") | |
| } | |
| something(); |
The final result: require() any module on npm in your browser console with browserify
This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.
Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5