Skip to content

Instantly share code, notes, and snippets.

@alexlau811
alexlau811 / ExtendedPageRenderer.cs
Created February 22, 2015 04:44
Move toolbar items with priority = 0 to LeftBarButtonItems on iOS with Xamarin Forms. Originally written by Murally at http://forums.xamarin.com/discussion/21004/navigation-bar-left-toolbar-button
[assembly: ExportRenderer(typeof(ContentPage), typeof(ExtendedPageRenderer))]
public class ExtendedPageRenderer : PageRenderer
{
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
var contentPage = this.Element as ContentPage;
if (contentPage == null || NavigationController == null)
@kenegozi
kenegozi / XunitConsoleForwarder.cs
Created June 25, 2017 22:35
Capturing console output in Xunit 2 tests
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Xunit.Abstractions;
namespace MagicalUnicorns {
public class XunitConsoleForwarder : TextWriter {
private readonly ITestOutputHelper output;
@LucGranato
LucGranato / index.html
Last active November 1, 2023 00:39
Monaco Editor Liquid Language
<div id="container" style="height:100%;"></div>
@micahlmartin
micahlmartin / gist:4261551
Created December 11, 2012 19:53
Convert anonymous object to dictionary
public static IDictionary<string, object> ToDictionary(this object values)
{
var dict = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
if (values != null)
{
foreach (PropertyDescriptor propertyDescriptor in TypeDescriptor.GetProperties(values))
{
object obj = propertyDescriptor.GetValue(values);
dict.Add(propertyDescriptor.Name, obj);
@JamieMason
JamieMason / group-objects-by-property.md
Created September 14, 2018 07:38
Group Array of JavaScript Objects by Key or Property Value

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;