Skip to content

Instantly share code, notes, and snippets.

@weitzhandler
weitzhandler / ResolutionChanger.cpp
Last active May 14, 2020
Toggle ultrawide resolution
View ResolutionChanger.cpp
#include <windows.h>
typedef DWORD PELS_WIDTH;
const PELS_WIDTH Wide = 3440;
const PELS_WIDTH Narrow = 2560;
int __cdecl main()
{
DEVMODEA dm;
View DataAnnotationsBehavior.cs
namespace System.Windows.Controls
{
using System;
using System.Collections;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
@weitzhandler
weitzhandler / ColumnReference.cs
Last active Nov 27, 2019
ColumnReference - easy way to convert between Excel column index and column letter
View ColumnReference.cs
internal struct ColumnReference
{
readonly uint _ColumnIndex;
const int AsciiTrim = 'A' - 1;
const int LastChar = 'Z' - AsciiTrim;
ColumnReference(uint columnIndex)
{
_ColumnIndex = columnIndex;
}
View MicrosoftDependencyResolverExtensions.cs
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
using ReactiveUI;
@weitzhandler
weitzhandler / MultiValueDictionary.cs
Last active Aug 29, 2017
MultiValueDictionary<TKey, TValue>
View MultiValueDictionary.cs
namespace System.Collections.ObjectModel
{
using System.Collections.Generic;
using System.Linq;
public class MultiValueDictionary<TKey, TElement>
: Collection<TElement>, ILookup<TKey, TElement>
{
public MultiValueDictionary(Func<TElement, TKey> keyExtractor)
: base(new Collection(keyExtractor))
View RangeObservableCollection.cs
namespace System.Collections.ObjectModel
{
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
View ListViewAutoSizeBehavior.cs
namespace Xamarin.Forms
{
public class AutoSizeBehavior : Behavior<ListView>
{
ListView _ListView;
protected override void OnAttachedTo(ListView bindable)
{
_ListView = bindable;
bindable.HeightRequest = 0;
View AppEntityBase.cs
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace TrackableEntities.Client
{
View ScalarCollection.cs
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Reflection;
namespace System.Collections.Specialized
@weitzhandler
weitzhandler / DeviceTimer.cs
Last active Jul 23, 2017
Device.Timer wrapper for Xamarin with Prism DI support
View DeviceTimer.cs
using System;
using System.Linq;
using System.Collections.Generic;
using Prism.Services;
namespace Xamarin.Forms
{
public class DeviceTimer
{
readonly Action _Task;