Meta | Nome | Função |
---|---|---|
. |
ponto | um caractere qualquer |
[] |
conjunto | conjunto de caracteres permitidos |
[^] |
conjunto negado | conjunto de caracteres proibidos |
<?php | |
namespace App\Http\Controllers; | |
use Illuminate\Contracts\Database\Eloquent\Builder; | |
use Illuminate\Contracts\Pagination\LengthAwarePaginator; | |
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; | |
use Illuminate\Foundation\Bus\DispatchesJobs; | |
use Illuminate\Foundation\Validation\ValidatesRequests; | |
use Illuminate\Routing\Controller as BaseController; |
enum OrderType { asc, desc, sad } | |
String enumToString(dynamic enumValue) => | |
enumValue.toString().replaceAll(RegExp(r"^.*?\."), ""); | |
E stringToEnum<E>(List<E> values, String target, [E defaultIfNoMatch]) { | |
return values.firstWhere((enm) => enumToString(enm) == target, | |
orElse: () => defaultIfNoMatch); | |
} |
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" | |
choco install dart-sdk androidstudio git | |
cd \ | |
mkdir src | |
cd \src | |
git clone https://github.com/flutter/flutter.git | |
cd flutter | |
start bin/flutter.bat doctor | |
start flutter_console.bat | |
@echo off |
final RegExp email = RegExp( | |
r"^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]" | |
r"{0,253}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,253}[a" | |
r"-zA-Z0-9])?)*$", | |
caseSensitive: false, | |
multiLine: false); | |
final RegExp mobileBrazilianPhone = RegExp(r"^\(?0?\d{2}\)? ?9 ?\d{4}-?\d{4}$", | |
caseSensitive: false, multiLine: false); |
public class ExemploPaginacaoFirebaseDoUltimoParaOPrimeiro{ | |
private DatabaseReference listaRef = FirebaseDatabase.getInstance().getReference("suaLista"); | |
private int numItensPorPagina = 15; | |
private ArrayList<SeuItem> itens = new ArrayList(); | |
private ChildEventListener meuChildEventListener = new ChildEventListener() { | |
@Override | |
public void onChildAdded(DataSnapshot dataSnapshot, String s) { | |
// Aqui ele registra a ultima key recebida e | |
// compara se a key atual é mais velha se for guardamos ela | |
if (ultimoItem == null) |
By default lumen doesn't support laravel file system. In order to integrate to lumen we need follow these instructions:
- composer require league/flysystem
- Copy filesystems config file from Laravel ( https://github.com/laravel/laravel/blob/master/config/filesystems.php ) to your local Lumen installation
document_root/config
- Bind
filesystem
to IoC for example indocument_root/bootstrap/app.php
by adding this code lines:
`` $app->singleton('filesystem', function ($app) {
/* | |
Hoje iremos MUDAR a vida da pessoa que não te responde no whatsappp... | |
Que tal enviar mensagens pra ela até obter uma resposta?! | |
Sensacional não acha?! Mas, somos devs, correto?! Então vamos automatizar esse paranauê! | |
Para utilizar: | |
- Abra o web.whatsapp.com; | |
- Selecione a conversa que você quer; | |
- Abra o console e cole o código que está no gist; |
UPDATE (Fall 2020): This gist is an updated version to the Windows 10 Fall Creators Update - Installing Node.js on Windows Subsystem for Linux (WSL) guide, I usually just keep here notes, configuration or short guides for personal use, it was nice to know it also helps other ppl, I hope this one too.
Windows updated windows subsystem for linux to version 2, as the F.A.Q stated you can still use WSL
version 1 side by side with version 2. I'm not sure about existing WSL
machines surviving the upgrade process, but as always backup and 🤞. NOTE: WSL
version 1 is not replace/deprecated, and there ar
/* | |
* Handling Errors using async/await | |
* Has to be used inside an async function | |
*/ | |
try { | |
const response = await axios.get('https://your.site/api/v1/bla/ble/bli'); | |
// Success 🎉 | |
console.log(response); | |
} catch (error) { | |
// Error 😨 |