Skip to content

Instantly share code, notes, and snippets.

View heytherewill's full-sized avatar

William Barbosa heytherewill

View GitHub Profile
@heytherewill
heytherewill / RxMappings.csv
Created March 3, 2019 20:03
Rx.NET mappings
Rx.NET name Reactive Extensions name
Observable.Return Observable.just
Select map
SelectMany flatMap
Where filter
Aggregate reduce
Debounce throttle
Synchronize serialize
@heytherewill
heytherewill / Observable.cs
Last active September 2, 2020 11:59
Use the common method names in Rx.Net instead of using the LINQ ones.
using System.Collections.Generic;
using System.Reactive.Concurrency;
using System.Reactive.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace System.Reactive.ApiMappings
{
public static class ObservableEx
{
using Android.App;
using Android.OS;
using Android.Support.Design.Widget;
using Android.Support.V7.App;
namespace LeakTest
{
[Activity(Label = "@string/app_name", Theme = "@style/AppTheme.NoActionBar", MainLauncher = true)]
public class MainActivity : AppCompatActivity
{
@heytherewill
heytherewill / EntryPoint.cs
Last active June 20, 2018 01:42
Basic IL modification
public class EntryPoint
{
public static void Main(string[] args)
{
// 1
var assemblyLocation = Assembly.GetExecutingAssembly().Location;
var pathToOriginalDll =
Path.GetFullPath(Path.Combine(assemblyLocation, "../path/to/your.dll"));
// 2
.class public auto ansi beforefieldinit WhatIWantToWrite
extends [System.Runtime]System.Object
{
// Methods
.method public hidebysig static
void Main (
string[] args
) cil managed
{
// Method begins at RVA 0x2050
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
</Project>
@heytherewill
heytherewill / WeaverIdeas.cs
Created May 12, 2018 07:26
Weaving made simple
public class WhatIWantToWrite
{
public static void Main(string[] args)
{
System.Console.WriteLine("This I wrote");
}
}
public class WhatIWantToGet
{
@heytherewill
heytherewill / .zshrc
Created March 1, 2018 20:52
IL decompiling made simple
function decompile() {
mono /path/to/ILSpyMac.exe -t il $1
}
private static class MathHelpers
{
public static bool IsEven(int number)
=> number % 2 == 0;
}
private class Tests
{
[Fact]
public void TheEvenMethodReturnsTrueIfTheNumberIsEven()
@heytherewill
heytherewill / FodyWeavers.xml
Created October 24, 2017 21:52
Code snippets for ".NET IL Weaving for those who know nothing about .NET IL Weaving"
<?xml version="1.0" encoding="utf-8" ?>
<Weavers>
<PropertyChanged />
</Weavers>