Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Always dealing with compilers, DDD, Clean Code and cross-platform stuff

José Manuel Nieto SuperJMN

💭
Always dealing with compilers, DDD, Clean Code and cross-platform stuff
View GitHub Profile
View Either.cs
void Main()
{
var result = ReadUser("JMN")
.Map(u => FindProduct(u))
.Map(p => ReadTechnicalDetails(p))
.Map(pd => View(pd))
.Handle(response => ErrorView(response));
Console.WriteLine(result);
}
View .NET community vision.md

Why is the .NET community so disperse, unwelcoming, unfocused and decreasing?

  1. .NET doesn't have a real community: there's no sense of belonging to a community. There are more or less big clusters, usually attached to particular projects.
  2. Microsoft usually acts like a competitor instead of a facilitator.
    • You can't try to do better than Microsoft. Whenever a project is doing some real good job in an area in which Microsoft has already placed its bet, you'll not only be ignored, but also repudiated by a big bunch of microsofties. You'll be on your own.
    • Eventually, if a community project looks like a winner and is getting momentum, Microsoft will try to catch up and make up for lost time creating an enemy product (usually inferior) in an attempt to undermine it.
  3. .NET fails to get to the young people. Why? because beginners usually start doing front-end, and front-end isn't .NET:
    • Front-end catches young people because it's visual and looks "easier" to get fancy resu
View The Uno Platform Migration Experience.md

Compile-time issues

Problem 1

error CS0260: Missing partial modifier on declaration of type 'ActualSizePropertyProxy'; another partial declaration of this type exists

All classes inheriting from UIElement must have the partial modifier. This is because of the NativeCtorGenerator This is present to avoid random crashes caused by iOS/Android internal behavior

Problem 2

warning NU1701: Package 'CommonServiceLocator 1.3.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.

View gist:ce6da379323447b6e75ede284ac0f870
public class UefiDownload : IDeploymentTask
{
private readonly IGitHubDownloader downloader;
private readonly IFileSystemOperations operations;
public UefiDownload(IGitHubDownloader downloader, IFileSystemOperations operations)
{
this.downloader = downloader;
this.operations = operations;
}
@SuperJMN
SuperJMN / KeyTrigger.cs
Created May 5, 2017
A Trigger that executes Actions when a KeyDown event occurs.
View KeyTrigger.cs
using System;
using System.Reactive.Linq;
using Windows.System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Input;
using Microsoft.Xaml.Interactivity;
namespace App2
{
public class KeyTrigger : Trigger
@SuperJMN
SuperJMN / PdfViewer.xaml.cs
Created Mar 13, 2017
UWP useful fragments
View PdfViewer.xaml.cs
using System;
using System.Collections.Generic;
using Windows.UI.Xaml;
namespace IbercajaPay.UWP.Controls
{
using System.Collections.ObjectModel;
using System.Reactive.Linq;
using System.Threading.Tasks;
using Windows.Data.Pdf;
@SuperJMN
SuperJMN / Specification.txt
Last active Jan 16, 2017
Tree-building language
View Specification.txt
* The language will represent a tree. Each node can have zero or more children.
It will look like this text (tabs matter):
Root
A
B
C
D
E
F
@SuperJMN
SuperJMN / Viewbox.cs
Last active Oct 1, 2018
AvaloniaUI's Viewbox
View Viewbox.cs
using Avalonia;
using Avalonia.Controls;
using Avalonia.Media;
using static System.Math;
public class Viewbox : Decorator
{
private IControl Root => Child;
protected override Size MeasureOverride(Size constraint)
View Mcd.cs
namespace Mcd
{
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine (Calculo.Mcd(75, 100));
}
}
View PausableRx.cs
void Main()
{
var xs = Observable.Interval(TimeSpan.FromSeconds(1));
var bs = new Subject<bool>();
var pxs = xs.Pausable(bs);
pxs.Subscribe(x => { Debug.WriteLine(x); });