Skip to content

Instantly share code, notes, and snippets.

View Axemasta's full-sized avatar

Axemasta

View GitHub Profile
//Create button
MGSwipeButton *swipeButton = MGSwipeButton buttonWithTitle:@"Title" icon:[UIImage imageNamed:@"your_image"] backgroundColor:[UIColor clearColor];
//Create view (to use as a mask)
CGFloat cellHeight = 90; //return your tableview cell height here
CGRect buttonFrame = CGRectMake(0, 0, cellHeight, cellHeight);
UIView *swipeButtonView = [[UIView alloc] initWithFrame:buttonFrame];
//Create gradient layer (I'm using a custom method to do this)
//This methods creates a gradient layer and adds it to my swipe button
@Axemasta
Axemasta / ButtonOverScrollView.xaml.cs
Last active February 5, 2018 10:23
C# Code that demonstrates how you can add a button over a scroll view for a Xamarin app
using Xamarin.Forms;
using System;
namespace ScrollViewFormatting
{
public partial class ScrollViewFormattingPage : ContentPage
{
public ScrollViewFormattingPage()
{
@Axemasta
Axemasta / ButtonOverScrollView.xaml
Last active February 2, 2018 16:46
XAML Code that demonstrates how you can add a button over a scroll view for a Xamarin app
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:ScrollViewFormatting"
x:Class="ScrollViewFormatting.ScrollViewFormattingPage">
<ContentPage.Padding>
<OnPlatform x:TypeArguments="Thickness">
<OnPlatform.iOS>0,20,0,0</OnPlatform.iOS>
</OnPlatform>
/// <summary>
/// The class map of the object you want to parse (The csv column headers)
/// <summary>
sealed class c : ClassMap<ParseUser>
{
/// <summary>
/// CSV Definition Map For <ParseUser>
/// </summary>
public ParseUserDefinitionMap()
{
@Axemasta
Axemasta / Options.cs
Created May 14, 2018 16:12
Command Line Parser Demo
class Options
{
// Omitting long name, defaults to name of property, ie "--verbose"
[Option(Default = false, HelpText = "Prints all messages to standard output.")]
public bool Verbose { get; set; }
}
@Axemasta
Axemasta / AndroidCornerRadiusRenderer.cs
Created July 25, 2018 08:41
Xamarin Android Corner Radius
protected override bool DrawChild(Canvas canvas, Android.Views.View child, long drawingTime)
{
float cornerRadius = child.Height / 2;
var path = new Path();
path.AddRoundRect(new RectF(0, 0, child.Width, child.Height), cornerRadius, cornerRadius, Path.Direction.Cw);
canvas.ClipPath(path);
return base.DrawChild(canvas, child, drawingTime);
}
@Axemasta
Axemasta / TestGist1.cs
Created August 14, 2018 13:25
Test Gist
var lol = "hello world";
@Axemasta
Axemasta / ViewModelAsyncLoad.cs
Created December 10, 2018 21:27
Demonstrates how api data can be fetched from a webservice when a viewmodel is initially loaded.
public class ExampleViewModel : INotifyPropertyChanged
{
private readonly IDataObjectService _dataObjectService;
ObservableCollection<DataObject> _bindedList;
ObservableCollection<DataObject> BindedList
{
get { return _bindedList; }
}
@Axemasta
Axemasta / XamarinIosModel
Created January 9, 2019 17:14
Converts the iphone model strong (using GetSystemLibraryProperty("hw.machine") from a device code to a device model. Xamarin Essentials returns the code iPhone1,1 instead of iPhone 1, this method will convert it.
/// <summary>
/// Gets the device model from model code.
/// https://stackoverflow.com/questions/11197509/how-to-get-device-make-and-model-on-ios
/// </summary>
/// <returns>The device model.</returns>
/// <param name="modelCode">Model code.</param>
private string GetDeviceModel(string modelCode)
{
switch (modelCode)
{
@Axemasta
Axemasta / ClassTemplates.cs
Created January 20, 2019 20:14
My C# Class Templates
public class ClassName
{
#region Properties
#endregion Properties
public ClassName()
{
}