Skip to content

Instantly share code, notes, and snippets.

View wldevries's full-sized avatar

Wouter de Vries wldevries

View GitHub Profile
@wldevries
wldevries / NineGridImage.cs
Last active June 20, 2018 02:09
Image.NineGrid for WPF
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
@wldevries
wldevries / InverseThrottle.cs
Created August 7, 2014 09:13
Inverse of standard Reactive Extensions Throttle by Christopher Harris
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reactive;
using System.Reactive.Linq;
using System.Reactive.Subjects;
namespace ObservableTests
@wldevries
wldevries / FmodProxy.cs
Created August 7, 2014 11:52
FMOD C# wrapper usage
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
class FmodProxy: IDisposable
public class Wow64RedirectDisabler : IDisposable
{
IntPtr ptr ;
public Wow64RedirectDisabler()
{
this.ptr = new IntPtr();
bool success = NativeMethods.Wow64DisableWow64FsRedirection(ref ptr);
Console.WriteLine("Disable Wow64 FS redirection success: " + success);
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.Practices.Prism.Regions
{
public static class NavigateAsyncMixins
{
public static async Task<NavigationResult> RequestNavigate(this INavigateAsync navigateAsync, string target, NavigationParameters navigationParameters = null)
using System;
using System.Threading.Tasks;
namespace Microsoft.Practices.Prism.Regions
{
public static class NavigationServiceMixins
{
public static async Task<NavigationResult> GoBack(this IRegionNavigationService service)
{
var tcs = new TaskCompletionSource<NavigationResult>();
using System;
using System.Threading.Tasks;
namespace Microsoft.Practices.Prism.Interactivity.InteractionRequest
{
public static class InteractionRequestMixins
{
public static async Task<T> RaiseAsync<T>(this InteractionRequest<T> request, T context) where T : INotification
{
return await AwaitCallbackResult<T>(callback => request.Raise(context, callback));
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Reactive.Testing;
@wldevries
wldevries / non_copyable.rs
Last active July 23, 2017 16:16
Lifetime issues with non-copyable owned values when trying to use them after passing them to a function
enum NonCopyable {
Node ( Box<NonCopyable> ),
Leaf
}
fn do_stuff() -> NonCopyable {
let x = NonCopyable::Leaf;
match try_wrap(x) {
(val, true) => val,
(val, false) => val,
@wldevries
wldevries / Program.cs
Last active April 30, 2023 20:56
Disable touch and gesture feedback in Windows
using System;
using System.Runtime.InteropServices;
namespace SetTouchSettings
{
class Program
{
private static class NativeMethods
{
[DllImport("user32.dll", EntryPoint = "SystemParametersInfo", SetLastError = true)]