In computing, memoization or memoisation
is an optimization technique used primarily
to speed up computer programs by storing
the results of expensive function calls and
returning the cached result when the same
inputs occur again.
— wikipedia
This file contains 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 android.annotation.SuppressLint; | |
import android.annotation.TargetApi; | |
import android.app.AppOpsManager; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.text.TextUtils; | |
import java.lang.reflect.Method; | |
// MIUI. Redefining Android. |
This file contains 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
// disable forced dark mode to prevent weird color changes on | |
// certain android devices (Xiaomi MIUI and others enforcing dark mode with view analyzing) | |
// create a file like "plugins/withDisableForcedDarkModeAndroid.js". Insert this content and edit your app.config.js/app.json | |
/* | |
"expo": { | |
... | |
... | |
... | |
"plugins": [ |
This file contains 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 { forEachObjIndexed } from "ramda"; | |
import * as React from "react"; | |
import { | |
Animated, | |
ScrollView, | |
View, | |
ViewStyle, | |
LayoutChangeEvent, | |
NativeScrollEvent, | |
} from "react-native"; |
This file contains 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
// web/webpack.config.js | |
const path = require('path'); | |
const webpack = require('webpack'); | |
const appDirectory = path.resolve(__dirname, '../'); | |
// This is needed for webpack to compile JavaScript. | |
// Many OSS React Native packages are not compiled to ES5 before being | |
// published. If you depend on uncompiled packages they may cause webpack build |
This file contains 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
private final Matrix mMatrix = new Matrix(); | |
private void updateMatrix() { | |
float mw = this.getWidth(); | |
float mh = this.getHeight(); | |
float hw = this.getWidth() / 2.0f; | |
float hh = this.getHeight() / 2.0f; | |
float cw = (float)Resources.getSystem().getDisplayMetrics().widthPixels; //Make sure to import Resources package |
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com
, example2.com
, and example1.com/images
on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers