Skip to content

Instantly share code, notes, and snippets.

View EmilAlipiev's full-sized avatar
🎯
Focusing

Emil Alipiev EmilAlipiev

🎯
Focusing
  • Freelancer
  • Germany
View GitHub Profile
@jonathanpeppers
jonathanpeppers / GzipHandler.cs
Last active June 8, 2022 05:39
DelegatingHandler for GZip in ASP.NET Web API
public class GzipHandler : DelegatingHandler
{
protected async override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
if (request.Content != null &&
request.Content.Headers.ContentType != null &&
(request.Content.Headers.ContentType.MediaType == "application/gzip" ||
request.Content.Headers.ContentType.MediaType == "application/deflate"))
{
string encodingType = request.Content.Headers.ContentType.MediaType.Split('/').Last();
public static class AkavacheExtensions
{
public static IObservable<string> GetOrFetchWithETag(this IBlobCache cache, string url)
{
var result =
// Get from cache
cache.GetObject<string>(url)
// Cached values are true
.Select(x => Tuple.Create(x, true))
@hjerpbakk
hjerpbakk / BindablePicker.cs
Created July 17, 2014 19:26
A Picker-control for Xamarin.Forms which enables data binding through an ItemsSource and the SelectedItem.
using System;
using Xamarin.Forms;
using System.Collections;
namespace YourNamespace.Views.Controls {
public class BindablePicker : Picker
{
public BindablePicker()
{
this.SelectedIndexChanged += OnSelectedIndexChanged;