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
View GitHub Profile
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms.Maps;
namespace RouteMap.Model
{
public class GooglePoints
{
public static IEnumerable<Position> Decode(string encodedPoints)
%%
%Valores
v=[57.58
57.10
57.10
56.61
56.61
57.10
57.58
57.10
@pictos
pictos / CSharp8.cs
Created October 28, 2019 20:08
Exemple of features of C#8 (It's not mine)
interface IProcessor<T,U> where T: unmanaged, IResult
{
T ProcessSingle(int x);
async IAsyncEnumerable<T> ProcessMany(int[] xs, int batch)
{
static T[] ProccessBatch(Func<int,T> func, Span<int> list, in Range range)
{
(_, int length) = range.GetOffsetAndLenght(list.length);
using var batcher = new Batcher<T>(stackalloc T[length]);
@pictos
pictos / RemovePage.cs
Created July 7, 2020 22:23
Work around to use remove page with XF
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Foundation;
using RemovePageReproduction.iOS;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Internals;
class BlaP
{
public static async Task<T> FromJsonHttpContent<T>(HttpContent httpContent)
{
Stream stream = null;
try
{
stream = await httpContent.ReadAsStreamAsync();
var res = DeserializeJsonFromsStream<T>(stream);
@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 / 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 / MemoryTest.cs
Created November 29, 2024 12:29
Helper Class used to identify memory leaks
namespace MemoryLeakTest;
static class MemoryTest
{
static readonly List<WeakReference<object>> weakReferences = [];
public static int Count => weakReferences.Count;
public static void Add(object obj)
{