Skip to content

Instantly share code, notes, and snippets.

View SuperJMN's full-sized avatar
💭
Always dealing with compilers, DDD, Clean Code and cross-platform stuff

José Manuel Nieto SuperJMN

💭
Always dealing with compilers, DDD, Clean Code and cross-platform stuff
View GitHub Profile
public class Match : ITwoPlayersGame
{
private Board Board { get; set; }
private MatchCoordinator Coordinator { get; set; }
public Match()
{
...
}
@SuperJMN
SuperJMN / ServiceStackTest
Last active August 29, 2015 14:03
ServiceStack.Text testing separator issue
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ServiceStack.Text;
namespace UnitTestProject1
{
[TestClass]
public class UnitTest1
{
private readonly List<Person> people = new List<Person>
@SuperJMN
SuperJMN / Course.cs
Last active August 29, 2015 14:08
MenuOption1
public class Course : ValueObject<Course>
{
private readonly string name;
private readonly int defaultPriority;
public Course(string name, int defaultPriority)
{
this.name = name;
this.defaultPriority = defaultPriority;
}
@SuperJMN
SuperJMN / Course.cs
Created November 5, 2014 19:43
MenuOption2
public class Course : ValueObject<Course>
{
private string name;
private int defaultPriority;
public Course(string name, int defaultPriority)
{
this.name = name;
this.defaultPriority = defaultPriority;
}
@SuperJMN
SuperJMN / Version1
Last active August 29, 2015 14:11
Comparison
protected override void OnKeyDown(KeyEventArgs e)
{
var modifiers = e.Device.Modifiers;
var key = e.Key;
if (IsNavigational(key))
{
var shouldSelectAlong = modifiers.HasFlag(ModifierKeys.Shift);
var isWordJumpEnabled = modifiers.HasFlag(ModifierKeys.Control);
this.MoveCaret(TranslateToDirection(key, modifiers), shouldSelectAlong, isWordJumpEnabled);
@SuperJMN
SuperJMN / Program.cs
Last active August 29, 2015 14:25
Breaking down cyclic dependency
namespace SampleForMark
{
using System;
class Program
{
static void Main(string[] args)
{
var factory = new Factory(injectedFactory => new Reader(injectedFactory));
factory.ExecuteSomething();
<Window Title="Perspex Test Application" Height="350" Width="525" xmlns="https://github.com/grokys/Perspex">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<Menu>
<MenuItem Header="File">
<MenuItem Header="Open">
<MenuItem.Icon>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollMode="Enabled"
ScrollViewer.VerticalScrollMode="Disabled"
ItemsSource="{Binding Collection}">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Background="Transparent" Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
@SuperJMN
SuperJMN / Pirula.xaml
Last active October 29, 2015 11:35
Snippets
<Page
x:Class="App10.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App10"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:system="using:System"
xmlns:collections="using:System.Collections"
mc:Ignorable="d">
@SuperJMN
SuperJMN / PausableRx.cs
Created January 20, 2016 19:27
StackOverflow
void Main()
{
var xs = Observable.Interval(TimeSpan.FromSeconds(1));
var bs = new Subject<bool>();
var pxs = xs.Pausable(bs);
pxs.Subscribe(x => { Debug.WriteLine(x); });