- PHP 8.3
- Laravel 11 with Spatie Laravel Query Builder
- Next.js 15 with TanStack Table
In many mobile browsers, a "pull down" gesture at the top of the page can trigger the "pull-to-refresh" functionality. While useful in some scenarios, this behavior can be undesirable in web applications that utilize touch elements or where the page should not be reloaded.
We can use touch events (touchstart and touchmove) to detect when the user tries to "pull down" from the top of the page. In this case, we can prevent the default refresh action, ensuring that normal scrolling continues to work.
To do this, I created the component below:
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 | |
namespace Infrastructure\Utils\OCR; | |
use Exception; | |
use Imagick; | |
use ImagickException; | |
use RuntimeException; | |
use thiagoalessio\TesseractOCR\TesseractOCR; |
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 | |
public function __toArray(): array | |
{ | |
return call_user_func('get_object_vars', $this); | |
} |
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 | |
function csvToArray($filename = '', $delimiter = '\t') | |
{ | |
if (!file_exists($filename) || !is_readable($filename)) | |
return []; | |
$row = 0; | |
$fileContent = []; | |
if (($handle = fopen($filename, "r")) !== FALSE) { |
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
import org.json.JSONException; | |
import org.json.JSONObject; | |
import java.lang.reflect.Field; | |
import java.lang.reflect.InvocationTargetException; | |
import java.lang.reflect.Method; | |
import java.util.ArrayList; | |
import io.realm.RealmObject; |
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
### Snippet para o VS Code | |
- Dentro do VS Code tecle `Ctrl + Shift + P`, digite `snippet` e escolha a opção `Preferences: Configure User Snippets`; | |
- Clicar em New Global Snippets file... | |
- Digite um nome para o arquivo; | |
- Apagar o conteudo do arquivo e inserir o json abaixo: |
NewerOlder