Skip to content

Instantly share code, notes, and snippets.

Kirill Davletkildeev darkiri

  • München
Block or report user

Report or block darkiri

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
View scala-school-questions.md
  • Scala syntax 5 questions - should be enough (?), there are question for beginner, intermediate and more advanced stuff. If not enough, more possible themes: type tags, dependent types...
    • How well do you know Option/Try/Either types from Scala standard library?
      • I heard about them, but I don't see clear benefits
      • I use them and understand the benefits, but I struggle with them
      • I fully understand why we use them and have no problems with them
    • How do you get and combine values from those types mentioned above?
      • I don't
      • I use map/flatMap most of the time
      • I try using for-comprehension most of the time
@darkiri
darkiri / MigratableObject.cs
Created Apr 30, 2013
Some ideas for MongoDB schema migrations using ISupportInitialize (based on https://github.com/darkiri/mongo-csharp-migrations)
View MigratableObject.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
namespace MongoDB.Migrations
{
public class MigratableObject : ISupportInitialize
{
@darkiri
darkiri / gist:3100444
Created Jul 12, 2012
Optimistic Concurrency MongoDB
View gist:3100444
var events = db.GetCollection("events");
events.Insert(new Event {Id = "1", Payload = 2});
events.Insert(new Event {Id = "1", Payload = 3}, SafeMode.True);
@darkiri
darkiri / gist:3100418
Created Jul 12, 2012
Optimistic Concurrency MongoDB
View gist:3100418
[Subject("Mongo")]
public class when_issuing_an_update_on_a_changed_entity : mongo_context
{
private static long DocumentsAffected;
private Establish context = () => SetUpDatabase();
private Because of = () => DocumentsAffected = UpdateSameObjectTwice();
private It should_not_affect_any_documents = () => Assert.That(DocumentsAffected, Is.EqualTo(0));
private static long UpdateSameObjectTwice()
@darkiri
darkiri / gist:3079035
Created Jul 9, 2012
Optimistic Concurrency in RavenDB
View gist:3079035
[Subject("Raven Experiments")]
public class when_storing_two_objects_with_same_id_in_separate_sessions : raven_persistence_context
{
static Exception Exception;
Because of = () => Exception = Catch.Exception(CreateTwoObjectsInTwoSessions);
It should_throw_concurrency_exception = () => Exception.ShouldBeOfType<ConcurrencyException>();
static void CreateTwoObjectsInTwoSessions()
{
@darkiri
darkiri / gist:3078953
Created Jul 9, 2012
Optimistic Concurrency in RavenDB
View gist:3078953
[Subject("Raven Experiments")]
public class when_updating_same_object_in_separate_sessions : raven_persistence_context
{
static Exception Exception;
Establish context = () => StoreSingleObject(new MyClass {Text = "this one"});
Because of = () => Exception = Catch.Exception(UpdateTwoObjectsInTwoSessions);
It should_throw_concurrency_exception = () => Exception.ShouldBeOfType<ConcurrencyException>();
static void UpdateTwoObjectsInTwoSessions()
@darkiri
darkiri / gist:2039990
Created Mar 14, 2012
is there a method which returns all .net base types/structs that System.Convert is able to convert to/from?
View gist:2039990
typeof (Convert)
.GetMethods(BindingFlags.Static|BindingFlags.Public)
.Where(m=>m.Name.StartsWith("To"))
.Select(m=>m.GetParameters().First().ParameterType)
.Distinct()
You can’t perform that action at this time.