- macOS latest
- Python3
- 下载mrc-converter-suite并解压
This is the full Cloud Functions code explained in my blog post: How to schedule a Cloud Function to run in the future (in order to build a Firestore document TTL)
| Future<Uint8List> _downloadImage() async { | |
| String dir = (await getApplicationDocumentsDirectory()).path; | |
| File file = new File('$dir/$_filename'); | |
| if (file.existsSync()) { | |
| var image = await file.readAsBytes(); | |
| return image; | |
| } else { | |
| var response = await http.get(_url,); | |
| var bytes = response.bodyBytes; |
| function slugify(string) { | |
| const a = 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìıİłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;' | |
| const b = 'aaaaaaaaaacccddeeeeeeeegghiiiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------' | |
| const p = new RegExp(a.split('').join('|'), 'g') | |
| return string.toString().toLowerCase() | |
| .replace(/\s+/g, '-') // Replace spaces with - | |
| .replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters | |
| .replace(/&/g, '-and-') // Replace & with 'and' | |
| .replace(/[^\w\-]+/g, '') // Remove all non-word characters |
| { | |
| "presets": [ | |
| ["env", { | |
| "targets": { | |
| "node": "6.10" | |
| } | |
| }] | |
| ] | |
| } |
Apple will reject apps that are using private url schemes (Ugh, Apple....) if they are pretty much obvius. Some apps are rejected and others are not, so, be aware of this issue before implementing any of those URL's in your app as a feature.
| import Foundation | |
| import WebKit | |
| final class WebCacheCleaner { | |
| class func clean() { | |
| HTTPCookieStorage.shared.removeCookies(since: Date.distantPast) | |
| print("[WebCacheCleaner] All cookies deleted") | |
| WKWebsiteDataStore.default().fetchDataRecords(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes()) { records in |
| Validator::extend('slug', function($attribute, $value, $parameters, $validator) { | |
| return preg_match('/^[a-z0-9]+(?:-[a-z0-9]+)*$/', $value); | |
| }); |