Skip to content

Instantly share code, notes, and snippets.

View kmorcinek's full-sized avatar

Krzysztof Morcinek kmorcinek

View GitHub Profile
@kmorcinek
kmorcinek / bridgeNotes
Created February 24, 2014 16:47
Nauka brydża
Impas - AQ na stoliku, małe na ręce, zagrywamy z ręki.
Ekspas - w dziadku kolor bez, na ręce bez koloru, ale są atu. Chcemy zgarnąć asa od przeciwnika. Gdy on zrzuca to my też. A gdy on asem to my atutem. Wychodzi dziadek.
Trzecia ręka bije i płacze
Lang albo blank (vist w singla)
X bez atu - bez wskazania koloru.
Nie pasuje się do "X bez atu" zazwyczaj.
Gdy popiera w kolorze to uzgadniamy pozostałe. vs Najpierw pokaż inne kolory a potem powtórz uzgadniany.
@kmorcinek
kmorcinek / newEnglishWords
Created February 24, 2014 16:59
Nowe angielskie słówka
moonshine - bimber
@kmorcinek
kmorcinek / ObjectExtensions
Created April 2, 2014 10:08
Chained null checks and the Maybe monad & others
using System;
public static class ObjectExtensions
{
public static TResult With<TInput, TResult>(this TInput o, Func<TInput, TResult> evaluator)
where TResult : class
where TInput : class
{
if (o == null) return null;
return evaluator(o);
List.map
List.filter
type Position =
struct
val X : int
val Y : int
new(x, y) = { X = x; Y = y}
end
@kmorcinek
kmorcinek / _vimrc
Created December 15, 2014 13:18
Vim configuration file _vimrc
set tabstop=4 shiftwidth=4 expandtab
private IEnumerable<string> GetAlphabetVariations()
{
char[] alphabet = "abcdefghijklmnopqrstuvwxyz".ToCharArray();
foreach (var first in alphabet)
{
foreach (var second in alphabet)
{
yield return "" + first + second;
}
public struct Option<T> : IEquatable<Option<T>>
{
[SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
public static readonly Option<T> None = new Option<T>();
private readonly T _value;
private readonly bool _hasValue;
public T Value
{
get
@kmorcinek
kmorcinek / Either.cs
Created June 12, 2015 09:38
Either<TSuccess, TFailure>
public class Either<TSuccess, TFailure>
{
private readonly TSuccess _success;
private readonly TFailure _failure;
private readonly bool _isSuccessful;
public bool Succeeded
{
get
{
from functools import reduce
http://www.artima.com/weblogs/viewpost.jsp?thread=98196
list("python")
https://docs.python.org/3/howto/functional.html
line_list = [' line 1\n', 'line 2 \n']