Skip to content

Instantly share code, notes, and snippets.

@weitzhandler
weitzhandler / ResolutionChanger.cpp
Last active May 14, 2020 14:18
Toggle ultrawide resolution
#include <windows.h>
typedef DWORD PELS_WIDTH;
const PELS_WIDTH Wide = 3440;
const PELS_WIDTH Narrow = 2560;
int __cdecl main()
{
DEVMODEA dm;
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 November 27, 2019 15:52
ColumnReference - easy way to convert between Excel column index and column letter
internal struct ColumnReference
{
readonly uint _ColumnIndex;
const int AsciiTrim = 'A' - 1;
const int LastChar = 'Z' - AsciiTrim;
ColumnReference(uint columnIndex)
{
_ColumnIndex = columnIndex;
}
// 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 September 17, 2021 14:23
MultiValueDictionary<TKey, TValue>
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))
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;
namespace Xamarin.Forms
{
public class AutoSizeBehavior : Behavior<ListView>
{
ListView _ListView;
protected override void OnAttachedTo(ListView bindable)
{
_ListView = bindable;
bindable.HeightRequest = 0;
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
{
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 July 23, 2017 19:41
Device.Timer wrapper for Xamarin with Prism DI support
using System;
using System.Linq;
using System.Collections.Generic;
using Prism.Services;
namespace Xamarin.Forms
{
public class DeviceTimer
{
readonly Action _Task;