Skip to content

Instantly share code, notes, and snippets.

@LynoDesu
LynoDesu / AndroidHelpers.cs
Created June 20, 2018 19:04
Disable ShiftMode in Xamarin.Forms Android BottomNavigationView
using System;
using Android.Support.Design.Internal;
using Android.Support.Design.Widget;
namespace MyProject.App.Droid.Helpers
{
public static class AndroidHelpers
{
public static void SetShiftMode(this BottomNavigationView bottomNavigationView, bool enableShiftMode, bool enableItemShiftMode)
{
@hjbotha
hjbotha / free_ports.sh
Last active May 20, 2025 14:10
Free ports 80 and 443 on Synology NAS
#! /bin/bash
# NEWLY ADDED BACKUP FUNCTIONALITY IS NOT FULLY TESTED YET, USE WITH CARE, ESPECIALLY DELETION
# Developed for DSM 6 - 7.0.1. Not tested on other versions.
# Steps to install
# Save this script in one of your shares
# Edit it according to your requirements
# Backup /usr/syno/share/nginx/ as follows:
# # cd /usr/syno/share/
# # tar cvf ~/nginx.tar nginx
@StephaneDelcroix
StephaneDelcroix / grid2.xaml
Last active November 21, 2018 09:00
Xamarin.Forms FlexLayout + CSS samples
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Xamarin.Forms.Controls.XamlPage">
<ContentPage.Resources>
<StyleSheet>
<![CDATA[
.section-title {
color: #778;
font-style: bold;
@weitzhandler
weitzhandler / AutoCompleteView.cs
Last active October 27, 2018 13:43
Xamarin.Forms AutoCompleteView
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Reflection;
using System.Windows.Input;
namespace Xamarin.Forms
version: '2'
services:
quasselcore:
environment:
- PGID=999
- PUID=999
image: 'linuxserver/quassel-core:latest'
ports:
- '4242:4242'
@thomaslevesque
thomaslevesque / ParseAuthChallenge.cs
Created February 23, 2017 00:56
Parsing HTTP authentication challenge with Sprache
void Main()
{
ParseAndPrintChallenge(@"Bearer realm=""FooCorp"", error=invalid_token, error_description=""The access token has expired""");
}
void ParseAndPrintChallenge(string input)
{
var challenge = Grammar.Challenge.Parse(input);
Console.WriteLine($"Scheme: {challenge.Scheme}");
Console.WriteLine($"Parameters:");
@dansiegel
dansiegel / BehaviorBase{T}.cs
Created August 3, 2016 22:03
Prism Tabbed Navigation
public class BehaviorBase<T> : Behavior<T> where T : BindableObject
{
public T AssociatedObject { get; private set; }
protected override void OnAttachedTo( T bindable )
{
base.OnAttachedTo( bindable );
AssociatedObject = bindable;
if( bindable.BindingContext != null )
@JakeGinnivan
JakeGinnivan / LogHelper.cs
Last active June 20, 2016 16:31
Helpers for xunit 2 to enable logging through Serilogs static Log type
public static class LogHelper
{
static readonly ConcurrentDictionary<Guid, ITestOutputHelper> LoggerLookup = new ConcurrentDictionary<Guid, ITestOutputHelper>();
public static void Log(string log)
{
var currentCorrelationId = (Guid?)CallContext.LogicalGetData("TestCorrelationId");
if (currentCorrelationId == null)
return;
@rid00z
rid00z / AndroidResourcesPolyFill.cs
Created May 16, 2016 03:00
This is a Android Resources Polyfill for Xamarin.Forms 2.2 when 3rd party libraries have not' updated.
using System;
namespace Yournamespace
{
public partial class Resource
{
public partial class Attribute
{
// public const int mediaRoutePlayDrawable = -1;
public const int mediaRouteSettingsDrawable = -2;
@davidfowl
davidfowl / Example1.cs
Last active September 2, 2024 12:36
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)