Skip to content

Instantly share code, notes, and snippets.

View nesteruk's full-sized avatar
🍸
retired

Dmitri Nesteruk nesteruk

🍸
retired
  • Mesa Funds
View GitHub Profile
using System;
using System.Linq;
namespace DotNetDesignPatternDemos.Structural.Proxy.Composite
{
// todo: publish
public class MasonrySettings
{
//public bool? All
//{
using System;
using System.Diagnostics;
namespace DotNetDesignPatternDemos.Structural.Proxy.ValueProxy
{
[DebuggerDisplay("{value*100.0f}%")]
public struct Percentage
{
private readonly float value;
using System;
using System.Linq;
namespace DotNetDesignPatternDemos.Structural.Adapter
{
// Vector2f, Vector3i
public interface IInteger
{
int Value { get; }
@nesteruk
nesteruk / SharpKitPhantomJS
Created December 2, 2011 12:02
SharpKit interface definitions for PhantomJS
using SharpKit.JavaScript;
namespace PhantomJS
{
[JsType(JsMode.Prototype, Export = false, Name = "console")]
public static class Console
{
public static void log(string message) {}
}
using System;
using System.Collections.Generic;
using System.Threading;
namespace DesignPatterns
{
public class Person
{
public string Name;
@nesteruk
nesteruk / MediatorExercise.swift
Created August 5, 2017 22:53
Swift mediator exercise
import Foundation
import XCTest
public protocol Disposable
{
func dispose()
}
protocol Invocable : class
{
@nesteruk
nesteruk / SwiftSubsequenceMindfuck.swift
Created August 4, 2017 21:17
Swift sequence-of-sequences mindfindfuck
import Foundation
import XCTest
class SingleValue : Sequence
{
var value = 0
init() {}
init(_ value: Int)
{
@nesteruk
nesteruk / BuilderFacets.rs
Created July 24, 2017 13:16
Fluent builder with lifetime/references removed... doesn't compile.
use std::marker::PhantomData;
use std::rc::Rc;
use std::fmt::Display;
struct Person
{
street_address: String,
postcode: String,
city: String,
@nesteruk
nesteruk / BuilderFacets.rs
Created July 24, 2017 12:54
Lifetime chaos when defining faceted builders for a simple type
use std::marker::PhantomData;
struct Person
{
street_address: String,
postcode: String,
city: String,
company_name: String,
position: String,
public class MyClass
{
static void Main(string[] args)
{
Console.WriteLine("test");
}
}