- Use the text provider from the OS to handle the texts within the apps from the keyboard.
- TextDocumentProxy on iOS.
- InputMethodService on Android.
- Loading must be fast (ressources might not be reused each time the keyboard appears).
Here's a performance comparison between PHP vs Python vs Ruby done by doing a Fibonacci sequence of 35 iterations in each language. I tried to adapt the codes in order to have the exact same behavior.
Tested versions are the following:
➜ php --version
PHP 8.0.3 (cli) (built: Mar 4 2021 20:39:15) ( NTS )
Copyright (c) The PHP Group
This file contains hidden or 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
| <?php | |
| $uri = $_SERVER['REQUEST_URI']; | |
| # Serve static ressources. | |
| if (preg_match('/\.(?:png|jpg|jpeg|gif|css|js|svg)$/', $uri)) { | |
| return false; | |
| } | |
| function register($method, $route, $callback) { | |
| global $uri; |
This file contains hidden or 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
| /** | |
| * Custom wrapper using the Fetch API. | |
| */ | |
| const Fetch = { | |
| async get (url) { return this.request(url, 'GET'); }, | |
| async post (url, data={}) { return this.request(url, 'POST', data); }, | |
| /** | |
| * Do a request. |
This file contains hidden or 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
| /* | |
| Create a new stylesheet for "instagram.com" with the Stylus* extension and | |
| add the following lines to it to remove their goddamn popup. | |
| * Install it from there: | |
| Firefox: https://addons.mozilla.org/en/firefox/addon/styl-us/ | |
| Chrome: https://chrome.google.com/webstore/detail/stylus/clngdbkpkpeebahjckkjfobafhncgmne | |
| */ | |
| body { overflow: unset !important; } | |
| .RnEpo { display: none; } |
This file contains hidden or 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
| #/usr/bin/env bash | |
| # | |
| # rename.sh | |
| # | |
| # Replace any occurency of "<source>" to "<target>" in a given <directory>. | |
| # This apply to (sub)folders/files name and files content. | |
| # Think about it like a refactoring function. | |
| # | |
| # Usage: rename.sh <source> <target> <directory> | |
| # |
This file contains hidden or 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
| /* Remove Medium.com's modal. */ | |
| .ar.as.dx.nn.no.np.nq.nr.ns.m.n.nt.o.p.nu { | |
| display:none; | |
| } |
This file contains hidden or 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
| #!/bin/bash | |
| # | |
| # Create a virtual disk on RAM with a given name and size. | |
| # To remove it, just unmount it in Finder. | |
| # | |
| # Usage: ram.sh <name> <size in MB> | |
| # | |
| function usage() { | |
| echo "$0 <name> <size in MB>" |