Skip to content

Instantly share code, notes, and snippets.

View lostmsu's full-sized avatar
💭
–2147483648x developer

Victor lostmsu

💭
–2147483648x developer
View GitHub Profile
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:zones="clr-namespace:LostTech.Stack.Zones;assembly=Stack"
xmlns:system="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
zones:Layout.Version="2"
Width="1024" Height="576"
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:zones="clr-namespace:LostTech.Stack.Zones;assembly=Stack"
mc:Ignorable="d"
Width="1024" Height="576"
d:DesignWidth="1024"
d:DesignHeight="576"
<zones:Zone.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding IsChecked, ElementName=StackLeftSide}" Value="True">
<Setter Property="zones:Zone.Layout">
<Setter.Value>
<ItemsPanelTemplate>
<UniformGrid Columns="1" />
</ItemsPanelTemplate>
</Setter.Value>
<zones:Zone.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding IsChecked, ElementName=StackLeftSide}" Value="True">
<Setter Property="zones:Zone.Layout">
<Setter.Value>
<ItemsPanelTemplate>
<UniformGrid Columns="1" />
</ItemsPanelTemplate>
</Setter.Value>
>>> class MyList(list):
... def __getitem__(self, idx):
... print('hello')
... return super().__getitem__(idx)
...
>>> l = MyList()
>>> l.append(42)
>>> l[0]
hello
42
class List:
def add(self, item): ...
class ListMixin:
def append(self, item): return self.add(item)
def mix_in(target_type, mixin):
???
mix_in(List, ListMixin)
@lostmsu
lostmsu / Static_vs_InlineReadonly.cs
Created May 12, 2020 20:16
Comparing static readonly bool field to static property, set to a value computable at compile time
namespace Inline_vs_Static_Readonly
{
using System;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;
[SimpleJob(RuntimeMoniker.Net48)]
[SimpleJob(RuntimeMoniker.Mono)]
[SimpleJob(RuntimeMoniker.NetCoreApp31)]
public class InlineOrStaticReadonly
@lostmsu
lostmsu / MyTree.cs
Created October 22, 2019 20:02
How to register converter for a generic type?
using Python.Runtime;
class MyNonGenericTree
{
}
PyTypeConversion<MyNonGenericTree>.Converter = tree => ...;
class MyTree<T>
{
namespace FormattingTest
{
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Formatting;
@lostmsu
lostmsu / LifeSpan.cs
Last active April 12, 2025 01:14
Control LifeSpan treadmill from C# (treadmill drops connection if not kept alive)
// License: MIT
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
public class LifeSpanTreadmill: IDisposable
{