This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative | |
unstage = reset HEAD -- | |
amend = commit --amend -C HEAD | |
co = checkout | |
ci = commit | |
st = status | |
br = branch | |
g = grep --break --heading --line-number | |
hist = log --graph --pretty=format:'%h %ad | %s%d [%an]' --date=short | |
last = log -1 HEAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class MyExtensions { | |
public static U CopyTo<U>(this Object obj){ | |
var objType = obj.GetType(); | |
var newType = typeof(U); | |
var newInstance = Activator.CreateInstance<U>(); | |
var objProperties = objType.GetProperties(BindingFlags.Instance | BindingFlags.Public); | |
var newProperties = newType.GetProperties(BindingFlags.Instance | BindingFlags.Public); | |
foreach(var prop in objProperties){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
Func<int,ExceptionSafe<int>> first = x => (1000 - x).ToSafe(); | |
Func<int,ExceptionSafe<int>> second = x => (100/x).ToSafe(); | |
Func<int,ExceptionSafe<double>> third = x => (0.68 * x).ToSafe(); | |
Func<int,ExceptionSafe<double>> composed = first.Compose(second).Compose(third); | |
900.ToSafe().ApplyFunction(composed).Dump(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
var outputPath = "Something.txt"; | |
var inputPath = "Something.mm"; | |
var nodes = LoadFromFile(inputPath); | |
var lines = nodes.SelectMany(x => GetPrefixedString(x,"")); | |
lines.Dump(); | |
File.WriteAllLines(outputPath,lines); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns GameOfLife.core) | |
(defn next-state [neighbours state] | |
(cond | |
(= :dying state) :dead | |
(and (= :alive state) | |
(or (= 2 neighbours) | |
(= 3 neighbours))) :alive | |
:else :dying)) | |