Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Aimoré Sá aimore

🏠
Working from home
Block or report user

Report or block aimore

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@aimore
aimore / BaseCommand.cs
Created May 13, 2020
Test base command class
View BaseCommand.cs
using System;
using System.Windows.Input;
using static System.Math;
namespace Test.ViewModels
{
public class BaseCommand : ICommand
{
public event EventHandler CanExecuteChanged;
@aimore
aimore / exception.txt
Last active Sep 24, 2019
Exception Android binding
View exception.txt
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Android.Tools.ApiXmlAdjuster.JavaApiXmlGeneratorExtensions.Save (Xamarin.Android.Tools.ApiXmlAdjuster.JavaTypeParameters typeParameters, System.Xml.XmlWriter writer, System.String indent) [0x000f0] in <bc1fe201558a400c810274a0a29f9006>:0
at Xamarin.Android.Tools.ApiXmlAdjuster.JavaApiXmlGeneratorExtensions.SaveCommon (Xamarin.Android.Tools.ApiXmlAdjuster.JavaMember m, System.Xml.XmlWriter writer, System.String elementName, System.String abs, System.String native, System.String ret, System.String sync, System.String transient, System.String type, System.String typeGeneric, System.String value, System.String volat, Xamarin.Android.Tools.ApiXmlAdjuster.JavaTypeParameters typeParameters, System.Collections.Generic.IEnumerable`1[T] parameters, System.Collections.Generic.IEnumerable`1[T] exceptions, System.Nullable`1[T] extBridge, System.String jniReturn, System.Nullable`1[T]
View HomeContent.json
{
"home": {
"promoCards": [
{
"title": "Lecker Burger",
"address": "Cheesy pizza 30% off and you get a second free",
"image": "https://d3i4yxtzktqr9n.cloudfront.net/web-eats/static/images/homepage/burger-image-550-0f1a479683.png",
"rigthWidget": "OPEN",
"leftWidget": "4.5"
},
@aimore
aimore / strings.json
Last active Jun 30, 2019
XamFood Strings Json
View strings.json
{
"appName": "Joe's",
"isPremium": false,
"styles": {
"backgroundColor": "#fefcfa",
"promoTitleColor": "#1b1b1b",
"tabBarColor": "#fefcfa",
"categoryTitleColor": "#fefcfa",
"descriptionColor": "",
"rightWidgetColor": "",
@aimore
aimore / IdentityServerHelper.swift
Last active May 24, 2020
IdentityServer4 helper for swift 4
View IdentityServerHelper.swift
//
// IdentityServerHelper.swift
// Example
//
// Aimore Sa on 5/6/19.
//
import Foundation
import AppAuth
@aimore
aimore / extension.cs
Created May 30, 2019
Image source extension xamarin
View extension.cs
[ContentProperty(nameof(Source))]
public class ImageResourceExtension : IMarkupExtension
{
public string Source { get; set; }
public object ProvideValue(IServiceProvider serviceProvider)
{
if (Source == null)
{
return null;
View PdfConverteriOS.cs
using System;
using System.Drawing;
using System.IO;
using CatCatalog.iOS.Services;
using CatCatalog.Services;
using CoreGraphics;
using Foundation;
using UIKit;
using Xamarin.Forms;
@aimore
aimore / OAuth2AuthenticatorEx.cs
Created Feb 4, 2019
Xamarin.Auth "Authentication Error: Invalid state from server. Possible forgery!" workaround
View OAuth2AuthenticatorEx.cs
public class OAuth2AuthenticatorEx : OAuth2Authenticator
{
protected override void OnPageEncountered(Uri url, IDictionary<string, string> query, IDictionary<string, string> fragment)
{
// Remove state from dictionaries.
// We are ignoring request state forgery status
// as we're hitting an ASP.NET service which forwards
// to a third-party OAuth service itself
if (query.ContainsKey("state"))
{
@aimore
aimore / SignatureCheck.cs
Last active Sep 28, 2018
Android signature security validation for Xamarin.Android
View SignatureCheck.cs
public bool ValidateAppSignature(Android.Content.Context context)
{
PackageInfo packageInfo = context.PackageManager.GetPackageInfo(context.PackageName, PackageInfoFlags.Signatures);
//note sample just checks the first signature
foreach (Signature signature in packageInfo.Signatures) {
// SHA1 the signature
String sha1 = GetSHA1(signature.ToByteArray());
// check is matches hardcoded value
return APP_SIGNATURE.Equals(sha1);
You can’t perform that action at this time.