Skip to content

Instantly share code, notes, and snippets.

using System.Diagnostics;
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace TowerOffense
{
/// <summary>
/// Helpers for cryptography. This class is shared through file linking in:
@Krumelur
Krumelur / Awaitable.cs
Created December 4, 2015 07:36
Shows how to make any class "awaitable".
using System;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
namespace AwaitTest
{
class MainClass
{
public static void Main (string[] args)
{
@Krumelur
Krumelur / CryptoHelpers.cs
Last active November 14, 2015 14:30
Helper to use managed AES encryption and easily encrypt an decrypt data. To see how the stream based methods work, have a look at `EncryptString()`.
using System.Diagnostics;
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace CryptoDemo
{
/// <summary>
/// Helpers for cryptography.
@Krumelur
Krumelur / GennericPagerAdapter.cs
Created October 29, 2015 09:08
Generic pager adapter for use with Android PagerTabStrip. This one used the v13 version with "native" Fragments
public class GenericPagerAdpapter<T> : Android.Support.V13.App.FragmentPagerAdapter where T : Fragment
{
public GenericPagerAdpapter (FragmentManager fm) : base(fm)
{
}
public Func<int, T> ItemAtPosition;
public Func<int> ItemCount;
public Func<int, string> TitleAtPosition;
@Krumelur
Krumelur / GameHelper.cs
Created October 23, 2015 13:51
GameHelper for Android Google Play Game Services with new ApiClient
using System;
using Android.Gms.Common;
using Android.Gms.Common.Apis;
using Android.Gms.Games.Achievement;
using Android.Gms.Games.LeaderBoard;
using Android.Gms.Games;
using Android.App;
using Android.Content;
using Android.Views;
using Java.Interop;
using System;
using Xamarin.Forms;
namespace VideoPlayback.Forms
{
/// <summary>
/// View to render media content. This view is backed by native renderers and uses AVPlayerViewController on iOS and VideoPlayerView on Android.
/// </summary>
public sealed class MediaView : ContentView
using System;
using UIKit;
namespace JackBox
{
// Addes the view of the first 50 boxes.
public partial class SecondViewController : UIViewController
{
BoxesViewL boxes50;
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
@Krumelur
Krumelur / Example.cs
Last active September 15, 2015 08:11
Android Extras Bundle Extensions for AND102 to prevent magic strings
// Put
intent.PutExtra(EXTRAS.ItemPosition, position);
// Get
int position = this.Intent.GetExtra(EXTRAS.ItemPosition, -1);
using System;
using System.Threading.Tasks;
namespace TestOp
{
class MainClass
{
public static void Main (string[] args)
{
var foo = new foo();