Skip to content

Instantly share code, notes, and snippets.

View juanpaexpedite's full-sized avatar
:octocat:
I may be slow to respond.

juanpaexpedite

:octocat:
I may be slow to respond.
View GitHub Profile
@juanpaexpedite
juanpaexpedite / DeviceManager.cs
Last active January 7, 2017 06:11
Updated Device Manager
public enum Devices
{
Phone,
Tablet,
Desktop,
Xbox,
IoT,
Continuum,
SurfaceHub
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Windows.Storage;
using Windows.UI.Xaml;
@juanpaexpedite
juanpaexpedite / Dark_Colors.svg
Created February 8, 2017 07:54
Windows 10 UWP Colors
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@juanpaexpedite
juanpaexpedite / Personaexample.svg
Created April 12, 2017 17:11
Persona waving inclusive design
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@juanpaexpedite
juanpaexpedite / LuaExample.xaml.cs
Created June 7, 2017 19:00
LUA waiting with await
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.Loaded += MainWindow_Loaded;
}
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
@juanpaexpedite
juanpaexpedite / WPFConverterBinding1_2.cs
Created November 3, 2017 19:49
WPF Converter with binding 1/2
public class ZIndexConverter : DependencyObject, IValueConverter
{
public string Size
{
get { return (string)GetValue(SizeProperty); }
set { SetValue(SizeProperty, value); }
}
public static readonly DependencyProperty SizeProperty =
DependencyProperty.Register(nameof(Size), typeof(string), typeof(ZIndexConverter), new PropertyMetadata("0,0",OnSizeChanged));
@juanpaexpedite
juanpaexpedite / WPFConverterBinding2_2.xaml
Created November 3, 2017 19:51
WPFConverterBinding2_2
<!--Remember to RaisePropertyChanged the ZIndex when Size Changes in the Model-->
<!-- And the viewmodel is defined like the following:
<Application.Resources>
<vm:PackViewModel x:Key="PackViewModel"/>
...
-->
<Grid Opacity="0.7" SnapsToDevicePixels="False" x:Name="ObjectZIndex" Visibility="{Binding IsZIndexSelector, Converter={StaticResource BoolVisibilityConverter}}" VerticalAlignment="Top" HorizontalAlignment="Left" Background="Transparent" Width="{Binding ElementName=BackPanel, Path=ActualWidth}" Height="1" RenderTransformOrigin="0,0">
<Grid.Resources>
@juanpaexpedite
juanpaexpedite / Settings.gd
Created May 7, 2018 09:00
GodotEngine 3.0 Settings
extends Node
enum {NON_EXISTING, LOAD_SUCCESS, LOAD_ERROR_COULDNT_OPEN}
const SAVE_PATH = "user://config.cfg"
var _config_file = ConfigFile.new()
func _ready():
var result = load_settings()
if result == NON_EXISTING:
SetDefault()
@juanpaexpedite
juanpaexpedite / ListDictionaryConverter.cs
Created January 19, 2019 20:01
This class converts a list serialized into a Dictionary and when you serialize back goes to a List again
public class ListDictionaryConverter<T> : JsonConverter where T : Entity
{
public override bool CanConvert(Type objectType)
{
return (objectType == typeof(object));
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
Dictionary<string, T> result;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;