Skip to content

Instantly share code, notes, and snippets.

View aztack's full-sized avatar
🎯
Focusing

Wang Weihua aztack

🎯
Focusing
View GitHub Profile
@hackape
hackape / checker_mod.ts
Last active January 26, 2023 15:18
Answer to Stack Overflow Question: "How can I see how TypeScript computes types?"
// https://github.com/microsoft/TypeScript/blob/ba5e86f1406f39e89d56d4b32fd6ff8de09a0bf3/src/compiler/checker.ts
// 1. add this line to ln:3
export const _conditionalTypes: any = {}
// 2. then replace ln:12303 to ln:12360
function trackConditionalType() {
// one time stuff
@kibotu
kibotu / WebViewClient
Last active February 13, 2023 03:27
Android WebView: resource interception and replacement by local resource
mWebView.setWebViewClient(new WebViewClient() {
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
if (url.contains("creditcard_cvc.jpg")) {
Log.v("WebView", "Replacing [" + url + "] with [R.raw.tmp_replacement]");
ContentResolver contentResolver = getActivity().getContentResolver();
return new WebResourceResponse(contentResolver.getType(Uri.parse(url)), "UTF-8", getResources().openRawResource(R.raw.tmp_replacement));
}
return super.shouldInterceptRequest(view, url);