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 'package:dio/dio.dart'; | |
Future<void> main() async { | |
final dio = Dio(); | |
//Using the same dio instance: crash | |
dio.interceptors.add(InterceptorWithError(dio)); | |
//Using different instance: works | |
//dio.interceptors.add(InterceptorWithError(Dio())); |
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
function Start-Emulator( | |
[ArgumentCompleter({ | |
param( | |
$CommandName, | |
$ParameterName, | |
$WordToComplete, | |
$CommandAst, | |
$FakeBoundParameters | |
) | |
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
function Get-FlutterHotFixes([int]$Amount = 2) { | |
$url = "https://raw.githubusercontent.com/wiki/flutter/flutter/Hotfixes-to-the-Stable-Channel.md" | |
$regex = "###\s*\[?(?<Version>\d+.\d+.\d+)\]?(?<Url>.*)\s(?<Changes>[\s\S]+?)(?=#+)" | |
Invoke-RestMethod $url | Select-String -Pattern $regex -AllMatches | ForEach-Object { | |
$_.Matches | ForEach-Object { [pscustomobject]@{ | |
Version = $_.Groups[1].Value | |
Url = $_.Groups[2].Value | |
Changes = $_.Groups[3].Value | |
} | |
} |
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
git config --global core.autocrlf 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
function toPascalCase([string] $text) { | |
return $text -replace '(?:^|_)(\p{L})', { $_.Groups[1].Value.ToUpper() } | |
} | |
function toSnakeCase([string] $text) { | |
$text = $text -replace '\s+', '_' # Replace spaces with underscores | |
$text = $text -replace '[-\.]', '_' # Replace dashes and dots with underscores | |
$text = $text -creplace '(?<![-_A-Z])(?<!^)[A-Z]', { "_$_" } # Insert underscores before uppercase letters | |
return $text.ToLower() | |
} |
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
# Looking for a object in path | |
Get-Command flutter | |
# Extracting a property from it | |
Get-Command flutter | Select-Object -ExpandProperty source | |
# Advanced String Interpolation (with expressions) | |
Get-ChildItem | ForEach-Object { Write-Output "The lenght: $($_.Length)" } |
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
$steam = Get-Process steam -ErrorAction Ignore | |
if ($null -eq $steam) { | |
Write-Output "Steam not found" | |
} | |
else { | |
$steam.Kill($true) | |
Write-Output 'Steam is dead' | |
} |
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
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\]) |
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 'package:path/path.dart' as path; | |
String getFlutterBinFolderPath() { | |
final pathString = Platform.environment['PATH']; | |
if (pathString == null) { | |
throw 'Flutter bin folder not located on PATH'; | |
} | |
final flutterPath = pathString.split(';').firstWhere( |
NewerOlder