Skip to content

Instantly share code, notes, and snippets.

View kmorcinek's full-sized avatar

Krzysztof Morcinek kmorcinek

View GitHub Profile
List.map
List.filter
type Position =
struct
val X : int
val Y : int
new(x, y) = { X = x; Y = y}
end
@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);
@kmorcinek
kmorcinek / readBooksByMe
Last active June 16, 2016 18:01
Przeczytane przeze mnie ksiażki
{"books": [
{"title": "New", "author": "CreateNewDoc()", "source": "http://google.com", "aroundDate": "12/12/12"},
{"title": "Algorithms", "author": "Robert Sedgewick", "source": "https://www.dropbox.com/s/37be80lwggp7fg9/Algorithm.pdf?dl=0", "aroundDate": "01/07/2011"},
{"title": "Pan raczy żartować, panie Feynman!", "author": "Richard Phillips Feynman", "source": "http://lubimyczytac.pl/ksiazka/38067/pan-raczy-zartowac-panie-feynman-przypadki-ciekawego-czlowieka", "aroundDate": "01/02/2014"},
{"title": "Rozmowy z katem", "author": "Kazimierz Moczarski", "source": "http://lubimyczytac.pl/ksiazka/6633/rozmowy-z-katem", "aroundDate": "01/02/2014", finished: false},
{"title": "The Truth About HTML5 (For Web Designers)", "author": "Luke Stevens ", "source": "http://www.truthabouthtml5.com/", "aroundDate": "01/04/2014"},
{"title": "Mastering Web Application Development with AngularJS", "author": "Pawel Kozlowski;Peter Bacon Darwin", "source": "http://www.amazon.com/Mastering-We
@kmorcinek
kmorcinek / quotes
Last active June 5, 2023 18:32
Quotes in json
{"quotes": [
{"content": "NIC NIE MUSISZ, MOŻESZ WSZYSTKO"},
{"content": "Always make new mistakes", author:"Esther Dyson"},
{"content": "Życie jest po to żeby wybrać źle", author:"Mirosław Kępiński"},
{"content": "Nie ma prawo i lewo - jest góra i dół", author: "Tomasz Agencki (AgenTomasz)"},
{"content": "If a man drinks wine and not water I cannot say he is acting irrationally. At most I can say that in his place I would not do so. But his pursuit of happiness is his own business, not mine.", author: "Ludwig von Mises"},
{"content": "Najmniejszą mniejszością na Ziemi jest jednostka. Ci, którzy odmawiają praw jednostkom, nie mogą twierdzić, że są obrońcami mniejszości", author: "Ayn Rand"},
{"content": "Co się stało na boisku, zostaje na boisku", author: "Bartek Zdybowicz"},
{"content": "Zapraszam Cie na kolacje i sniadanie - i żeby nie było wątpliwości - w takiej właśnie kolejnosci.", author: "Daniel Zaborowski"},
{"content": "jak byłem w podstawówce to
@kmorcinek
kmorcinek / newEnglishWords
Created February 24, 2014 16:59
Nowe angielskie słówka
moonshine - bimber
@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 / code.cs
Last active December 19, 2015 04:48
public int Add(int a, int b)
{
return a + b;
}
public void Foo()
{
Func<int,int> add5 = x => Add(5, x);
}
public static class EnumExtensions
{
public static bool TryConvert<TEnum>(int intValue, out TEnum enumValue) where TEnum : struct
{
if (typeof(TEnum).IsEnum == false)
{
throw new ArgumentException("TryConvert works only for Enum types");
}
if (Enum.IsDefined(typeof(TEnum), intValue) == false)
@kmorcinek
kmorcinek / gitconfig
Last active February 27, 2022 18:45
Add it to ".gitconfig" file in your user directory. Configuration & aliases for git.
[core]
# autocrlf = true/input # it should be done explicit using .gitattributes https://help.github.com/en/github/using-git/configuring-git-to-handle-line-endings
[pull]
rebase = true
[push]
default = current
[alias]
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%an]" --decorate
lst = log --pretty=format:%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%an] --decorate -10
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cgreen\\ [%an]" --decorate --date=short
Swiftkey
Download manager for mp3 download.
Falcon for twitter.
Sleettime
Google drive
Blokowanie obracania