Skip to content

Instantly share code, notes, and snippets.

View AlejandroRuiz's full-sized avatar
🇲🇽
I Code, Therefore I Am

Alejandro Ruiz AlejandroRuiz

🇲🇽
I Code, Therefore I Am
View GitHub Profile
@AlejandroRuiz
AlejandroRuiz / ImageSourceExtensions.cs
Created June 2, 2020 03:25
Xamarin Month - Code Snippets: Convert Xamarin.Forms ImageSource to Native Image
using System.Threading.Tasks;
using Xamarin.Forms;
#if __IOS__
using Xamarin.Forms.Platform.iOS;
using UIKit;
#elif __ANDROID__
using Android.Graphics;
using Xamarin.Forms.Platform.Android;
using Application = Android.App.Application;
#endif
var httpHandler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (o, cert, chain, errors) => true
};
var client = new HttpClient(httpHandler);
@AlejandroRuiz
AlejandroRuiz / MainPage.xaml
Created February 17, 2020 19:04
MediaElement usage
<MediaElement
x:Name="_mediaElement"
HeightRequest="200"
Aspect="{Binding Aspect}"
AutoPlay="{Binding AutoPlay}"
IsLooping="{Binding IsLooping}"
KeepScreenOn="{Binding KeepScreenOn}"
ShowsPlaybackControls="{Binding ShowsPlaybackControls}"
Source="{Binding Source}"
VerticalOptions="Start" />
@AlejandroRuiz
AlejandroRuiz / App.xaml.cs
Created February 17, 2020 18:59
MediaElement experimental flag config
public partial class App : Application
{
static App()
{
Device.SetFlags(new[] { "MediaElement_Experimental" });
}
public App()
{
InitializeComponent();
@AlejandroRuiz
AlejandroRuiz / App.cs
Created December 22, 2019 21:58
Meadow Demo App
public class App : App<F7Micro, App>
{
DisplayTftSpiBase display;
ISpiBus spiBus;
public App()
{
var config = new SpiClockConfiguration(6000, SpiClockConfiguration.Mode.Mode3);
spiBus = Device.CreateSpiBus(Device.Pins.SCK,
Device.Pins.MOSI,
@AlejandroRuiz
AlejandroRuiz / GPlayMusicSearchHandler.cs
Created July 29, 2019 06:04
Xamarin Forms Custom SearchHandler
public class GPlayMusicSearchHandler : SearchHandler
{
public GPlayMusicSearchHandler()
{
}
protected override void OnQueryChanged(string oldValue, string newValue)
{
base.OnQueryChanged(oldValue, newValue);
@AlejandroRuiz
AlejandroRuiz / CollectionView.xaml
Created July 29, 2019 05:46
CollectionView Xamarin Forms
<!--
REGULAR COLLECTION VIEW(LISTVIEW STYLE)
-->
<CollectionView ItemsSource="{Binding Cards}">
<CollectionView.ItemTemplate>
<DataTemplate>
<views:HomeCardView />
<?xml version="1.0" encoding="UTF-8"?>
<Shell
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:local="clr-namespace:GPlayMusic.Views"
Title="GPlayMusic"
x:Class="GPlayMusic.AppShell">
@AlejandroRuiz
AlejandroRuiz / RequestResponses.json
Created November 24, 2018 02:45
ASP.NET Core Identity with Cosmos DB (MongoDB)
//api/v1/user/register
//Request
{
"Email": "demo@gmail.com",
"Password": "Test1234!",
"ConfirmPassword": "Test1234!",
"Name": "Alejandro",
"LastName": "Ruiz",
"City": "Guadalajara"
}
@AlejandroRuiz
AlejandroRuiz / UserController.cs
Created November 24, 2018 02:27
ASP.NET Core Identity with Cosmos DB (MongoDB)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;