Skip to content

Instantly share code, notes, and snippets.

Avatar

William Barbosa heytherewill

View GitHub Profile
View Leak.cs
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
{
View RxMappings.csv
Rx.NET name Reactive Extensions name
Observable.Return Observable.just
Select map
SelectMany flatMap
Where filter
Aggregate reduce
Debounce throttle
Synchronize serialize
@heytherewill
heytherewill / EntryPoint.cs
Last active Jun 20, 2018
Basic IL modification
View EntryPoint.cs
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
View WeaverTest.il
.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
View minimal.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
</Project>
View WeaverIdeas.cs
public class WhatIWantToWrite
{
public static void Main(string[] args)
{
System.Console.WriteLine("This I wrote");
}
}
public class WhatIWantToGet
{
@heytherewill
heytherewill / .zshrc
Created Mar 1, 2018
IL decompiling made simple
View .zshrc
function decompile() {
mono /path/to/ILSpyMac.exe -t il $1
}
View UnitTests.cs
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 Oct 24, 2017
Code snippets for ".NET IL Weaving for those who know nothing about .NET IL Weaving"
View FodyWeavers.xml
<?xml version="1.0" encoding="utf-8" ?>
<Weavers>
<PropertyChanged />
</Weavers>
@heytherewill
heytherewill / WovenLoginViewModel.cs
Created Oct 24, 2017
Code snippets for ".NET IL Weaving for those who know nothing about .NET IL Weaving"
View WovenLoginViewModel.cs
namespace Woven
{
//BaseViewModel implements INotifyPropertyChanged
public sealed class LoginViewModel : BaseViewModel
{
public bool IsLoading { get; set; }
public string Email { get; set; }
public string Password { get; set; }