Skip to content

Instantly share code, notes, and snippets.

View Cheesebaron's full-sized avatar
🧀
Send cheese please

Tomasz Cielecki Cheesebaron

🧀
Send cheese please
View GitHub Profile
@Cheesebaron
Cheesebaron / MvxFixture.cs
Created March 24, 2017 12:49
MvvmCross xUnit Fixture
public class MvxFixture : IDisposable
{
public MvxFixture()
{
MvxTest.Initialize();
}
~MvxFixture()
{
Dispose(false);

Keybase proof

I hereby claim:

  • I am cheesebaron on github.
  • I am cheesebaron (https://keybase.io/cheesebaron) on keybase.
  • I have a public key ASBnP2BeBE9HsuJU2uWnS0wqLGqsIu08jD_IBEfa9amx2Ao

To claim this, I am signing this object:

public sealed class Snackbar : UIView
{
public TimeSpan Duration { get; set; }
public Action<Snackbar> OnAction { get; set; }
public Action<Snackbar> OnDismiss { get; set; }
private static Snackbar _currentlyVisibleSnackbar;
private readonly UILabel _messageLabel;
private readonly UIButton _actionButton;
private readonly UIView _separator;
private NSLayoutConstraint[] _horizontalLayoutConstraints;
@Cheesebaron
Cheesebaron / CircleView.cs
Last active November 29, 2015 02:01
Waves represented by circles! See gfycat here: http://gfycat.com/AfraidRequiredEsok
using System;
using Android.Content;
using Android.Graphics;
using Android.Runtime;
using Android.Util;
using Android.Views;
namespace CircleWaves
{
public class CircleView : View
@Cheesebaron
Cheesebaron / CaptureUiElements.cs
Created August 25, 2015 08:40
Capture UI elements Windows
protected async Task<RenderTargetBitmap> CaptureUiElementToStreamAsync(FrameworkElement uiElement,
IRandomAccessStream stream)
{
return await CaptureUiElementToStreamAsync(uiElement, stream, BitmapEncoder.PngEncoderId);
}
private async Task<RenderTargetBitmap> CaptureUiElementToStreamAsync(FrameworkElement uiElement,
IRandomAccessStream stream, Guid encoderId)
{
if (uiElement == null) throw new ArgumentNullException(nameof(uiElement));
@Cheesebaron
Cheesebaron / DeviceInfo.cs
Last active August 29, 2015 14:26
Year classification for Android. Based on Facebook's device-year-class: https://github.com/facebook/device-year-class
using System;
using System.IO;
using System.Linq;
using Android.OS;
using Android.Util;
namespace DeviceYearClass
{
public class DeviceInfo
{
public static class ColorUtils
{
public static class LabConstants
{
public const int Kn = 18;
public const float Xn = 0.950470f;
public const float Yn = 1f;
public const float Zn = 1.088830f;
@Cheesebaron
Cheesebaron / CircularProgressDrawable.cs
Created July 9, 2015 08:42
CircularProgressDrawable, based on castorflex's Java implementation here: https://gist.github.com/castorflex/4e46a9dc2c3a4245a28e
[Register("dk.ostebaronen.droid.CircularProgressDrawable")]
public class CircularProgressDrawable
: Drawable
, IAnimatable
{
private static readonly IInterpolator AngleInterpolator = new LinearInterpolator();
private static readonly IInterpolator SweepInterpolator = new DecelerateInterpolator();
private static readonly RectF _bounds = new RectF();
private const int AngleAnimatorDuration = 2000;
/*
* C# derivative of m_random.c used in DOOM
* https://github.com/id-Software/DOOM/blob/master/linuxdoom-1.10/m_random.c
*
* Copyright (C) 1993-1996 by id Software, Inc.
*
* This source is available for distribution and/or modification
* only under the terms of the DOOM Source Code License as
* published by id Software. All rights reserved.
*