Skip to content

Instantly share code, notes, and snippets.

View pictos's full-sized avatar
🐒
Creating tools for you

Pedro Jesus pictos

🐒
Creating tools for you
  • Brasil
  • 03:42 (UTC -03:00)
View GitHub Profile
@pictos
pictos / MSBuildCheatSheet.xml
Created October 30, 2024 03:27 — forked from dotMorten/MSBuildCheatSheet.xml
MSBuild Cheat Sheet
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
How to define a variable.
Just stick a new node in a property group.
-->
<PropertyGroup>
<!-- This node in a property group will define a variable -->
<TestVariable>Test Variable Value</TestVariable>
@pictos
pictos / ReelNavigation.cs
Created June 21, 2024 01:01
a view that implements the Reels navigation
sealed class SwipePageView : ContentView
{
View _firstPage;
View _secondPage;
AbsoluteLayout mainLayout;
bool flagThatIdontKnowHowToNameIt = false;
const uint length = 300;
const uint rate = 16;
Action<double> animateTransitionFirstPageAction;
Action<double> animateTransitionSecondPageAction;
@pictos
pictos / usingForLazyPeople.cs
Last active March 28, 2024 04:21
A ref struct that will tweak values for you
new ViewModel().Run();
class ViewModel
{
private bool flag = true;
public bool Flag {get; set;} = false;
public void Run()
{
using(new HoldAndChangeValue(ref flag, () => Flag = !Flag))
{
@pictos
pictos / bench.cs
Created July 17, 2023 18:41
someBenchmarkCode
using BenchmarkDotNet.Attributes;
namespace GeneralBench;
public record Registro
{
public required string Nome { get; init; }
public int Total { get; init; }
}
[MemoryDiagnoser]
/*
SharpLab tools in Run mode:
• value.Inspect()
• Inspect.Heap(object)
• Inspect.Stack(value)
• Inspect.MemoryGraph(value1, value2, …)
*/
using System;
using System.Threading.Tasks;
public class GravatarImageSource : ImageSource
{
/// <summary>The backing store for the <see cref="Email" /> bindable property.</summary>
public static readonly BindableProperty? EmailProperty = BindableProperty.Create(nameof(Email), typeof(string), typeof(GravatarImageSource), defaultValue: GravatarImageSourceDefaults.DefaultEmail, propertyChanged: OnEmailPropertyChanged);
/// <summary>The backing store for the <see cref="Image" /> bindable property.</summary>
public static readonly BindableProperty ImageProperty = BindableProperty.Create(nameof(Image), typeof(DefaultImage), typeof(GravatarImageSource), defaultValue: GravatarImageSourceDefaults.Defaultimage, propertyChanged: OnDefaultImagePropertyChanged);
/// <summary>Gets or sets the email address.</summary>
public string? Email
class BlaP
{
public static async Task<T> FromJsonHttpContent<T>(HttpContent httpContent)
{
Stream stream = null;
try
{
stream = await httpContent.ReadAsStreamAsync();
var res = DeserializeJsonFromsStream<T>(stream);
static class ComicRouteFactory
{
public static RouteFactory Create<TPage, TViewModel>()
where TPage : Page, new()
where TViewModel : BaseViewModel
{
return new Factory<TPage, TViewModel>();
}
private class Factory<GPage, GViewModel> : RouteFactory
@pictos
pictos / VLCService.cs
Created August 13, 2021 00:07
VLCService
using LibVLCSharp.Shared;
using static MediaPlayerX.Helpers.GlobalResources;
using MediaPlayerX.Models;
using System;
using System.Threading.Tasks;
using Xamarin.Forms;
using MediaPlayerX.Helpers;
using System.Collections.ObjectModel;
@pictos
pictos / CornerRadiusXCT.cs
Created May 24, 2021 22:45
Spec to using an Attached property
public class CornerRadiusEffect
{
public static readonly BindableProperty CornerRadiusProperty = BindableProperty.CreateAttached(
nameof(CornerRadius),
typeof(CornerRadius),
typeof(CornerRadiusEffect),
default(CornerRadius),
propertyChanged: OnCornerRadiusPropertyChanged);
static void OnCornerRadiusPropertyChanged(BindableObject bindable, object oldValue, object newValue)