Skip to content

Instantly share code, notes, and snippets.

@stalniy
stalniy / fix-browserify-wkwebview.js
Created August 5, 2017 20:28
Cordova hook to fix WK WebView and --browserify option (temporary workaround)
/**
* Just add this script as `after_build` and `after_prepare` hook in config.xml for ios platform.
*/
const { join } = require('path')
const fs = require('fs')
// TODO: Remove this after https://issues.apache.org/jira/browse/CB-11311 is fixed
module.exports = function(ctx) {
if (!ctx.opts.browserify) {
@tatocaster
tatocaster / RealPathUtil.java
Last active May 5, 2024 16:59
Real Path Utility class for Android, works for all API
public class RealPathUtil {
public static String getRealPath(Context context, Uri fileUri) {
String realPath;
// SDK < API11
if (Build.VERSION.SDK_INT < 11) {
realPath = RealPathUtil.getRealPathFromURI_BelowAPI11(context, fileUri);
}
// SDK >= 11 && SDK < 19
else if (Build.VERSION.SDK_INT < 19) {
@zmmbreeze
zmmbreeze / addChineseUnit.js
Last active December 31, 2021 02:45
为数字加上单位:万或亿
/**
* 为数字加上单位:万或亿
*
* 例如:
* 1000.01 => 1000.01
* 10000 => 1万
* 99000 => 9.9万
* 566000 => 56.6万
* 5660000 => 566万
* 44440000 => 4444万