Skip to content

Instantly share code, notes, and snippets.

Lev Gorodinski eulerfx

Block or report user

Report or block eulerfx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jen20
jen20 / MessageIdentity.cs
Created Aug 19, 2014
Generator for deterministic GUIDs
View MessageIdentity.cs
public class MessageIdentity
{
public Guid NameSpace;
private readonly byte[] _namespaceBytes;
public MessageIdentity(Guid guidNameSpace)
{
NameSpace = guidNameSpace;
_namespaceBytes = guidNameSpace.ToByteArray();
SwapByteOrder(_namespaceBytes);
@andrejbauer
andrejbauer / Bijection.md
Last active Nov 26, 2018
A bijection between numbers and pairs of numbers.
View Bijection.md

A bijection between numbers and pairs of numbers

Every once in a while I am faced with someone who denies that the rational numbers (or fractions, or pairs of integers) can be put into a bijective correspondence with natural numbers. To deal with the situation, I coded up the bijection. So now I can just say: "Really? Interesting. Please provide a pair of numbers (i,j) which is not enumerated by f, as defined in my gist." I am still waiting for a valid counter-example.

Anyhow, here is a demo of f and g at work. I am using the Python version, but a Haskell variant is included as well.

The 100-th pair is:

>>> f(100)
(10, 4)
View gist:10045379
import scalaz._
// A right Kan extension of `F` along itself, constrained by `C`.
trait RCodensity[C[_], F[_], A] {
def apply[R:C](k: A => F[R]): F[R]
}
object RCodensity {
implicit def codensityMonad[C[_], F[_]]: Monad[({type f[x] = RCodensity[C,F,x]})#f] =
new Monad[({type f[x] = RCodensity[C,F,x]})#f] {
@SzymonPobiega
SzymonPobiega / gist:5220595
Last active Sep 7, 2019
DDD/CQRS/ES/Architecture videos
View gist:5220595

If you have two days to learn the very basics of modelling, Domain-Driven Design, CQRS and Event Sourcing, here's what you should do:

In the evenings read the [Domain-Driven Design Quickly Minibook]{http://www.infoq.com/minibooks/domain-driven-design-quickly}. During the day watch following great videos (in this order):

  1. Eric Evans' [What I've learned about DDD since the book]{http://www.infoq.com/presentations/ddd-eric-evans}
  2. Eric Evans' [Strategic Design - Responsibility Traps]{http://www.infoq.com/presentations/design-strategic-eric-evans}
  3. Udi Dahan's [Avoid a Failed SOA: Business & Autonomous Components to the Rescue]{http://www.infoq.com/presentations/SOA-Business-Autonomous-Components}
  4. Udi Dahan's [Command-Query Responsibility Segregation]{http://www.infoq.com/presentations/Command-Query-Responsibility-Segregation}
  5. Greg Young's [Unshackle Your Domain]{http://www.infoq.com/presentations/greg-young-unshackle-qcon08}
  6. Eric Evans' [Acknowledging CAP at the Root -- in the Domain Model]{ht
@tugberkugurlu
tugberkugurlu / gist:3848723
Created Oct 7, 2012 — forked from benfoster/gist:3848715
Adding IServiceProvider to ValidationContext in ASP.NET MVC
View gist:3848723
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
/* usual sh** ommitted for brevity */
var resolver = new CustomDependencyResolver();
DependencyResolver.SetResolver(resolver);
DataAnnotationsModelValidatorProvider.RegisterDefaultAdapterFactory(
@coldnebo
coldnebo / Default (Linux).sublime-keymap
Created Aug 10, 2011
simple scripts to prettify your xml and json in sublime text 2
View Default (Linux).sublime-keymap
[
{ "keys": ["ctrl+shift+x"], "command": "tidy_xml" },
{ "keys": ["ctrl+shift+j"], "command": "prettify_json" }
]
You can’t perform that action at this time.