Skip to content

Instantly share code, notes, and snippets.

@dlidstrom
dlidstrom / github-starter.markdown
Created Jan 11, 2011
Komma igång med GitHub
View github-starter.markdown

Hämta msysgit

Jag har version 1.7.3.1.msysgit.0. msysgit google.code

Git Alias

Sätt upp git med ditt namn och några alias:

C:\Users\Daniel>git config --global --list
user.name=Daniel Lidstrom
user.email=dlidstrom@gmail.com
alias.co=checkout
View Specification.markdown

First of all, here’s something you can do with the Specification class to reduce some of the code you have to write. Add the following methods:

public AndSpecification<TEntity> And(Expression<Func<TEntity, bool>> second)
{
    return new AndSpecification<TEntity>(this, new Specification<TEntity>(second));
}

public OrSpecification<TEntity> Or(Expression<Func<TEntity, bool>> second)
{
    return new OrSpecification<TEntity>(this, new Specification<TEntity>(second));
@dlidstrom
dlidstrom / Specification.cs
Created Jan 15, 2011
Specification design pattern
View Specification.cs
using System;
using System.Linq;
using System.Linq.Expressions;
using Infrastructure.Data.Extensions;
namespace Infrastructure.Data.Specification
{
public class Specification<TEntity> : ISpecification<TEntity>
{
public Specification(Expression<Func<TEntity, bool>> predicate)
@dlidstrom
dlidstrom / NLog.config
Created Jan 19, 2011
How to configure Castle Windsor with logging.
View NLog.config
<?xml version="1.0" encoding="utf-8" ?>
<!--
This file needs to be put in the application directory. Make sure to set
'Copy to Output Directory' option in Visual Studio.
-->
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target xsi:type="Console" name="console" layout="${message}" />
<target xsi:type="ColoredConsole" name="console-detailed" layout="${longdate} ${logger} ${level:upperCase=true}: ${message}${newline}(${stacktrace}) ${exception:format=ToString}" />
View readme.markdown

GridBook, Large Scale Othello

Introduction

This is a project where I am intending to do a large-scale distributed calculation of an opening book for the board game Othello. Positions are stored in a relational database (I have chosen PostgreSQL) using NHibernate object/relational mapper.

The project is still in its infancy, but the goal is to use Edax, a very good Othello engine, to calculate new positions. I am also intending to use a service bus, probably

View RavenIndexTest.cs
namespace RavenIndexTest
{
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition.Hosting;
using System.Linq;
using System.Threading;
using Newtonsoft.Json;
using Raven.Client.Embedded;
using Raven.Client.Indexes;
@dlidstrom
dlidstrom / RavenIndexTest_working.cs
Created Oct 13, 2011
Raven indexing test (working)
View RavenIndexTest_working.cs
namespace RavenIndexTest
{
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition.Hosting;
using System.Linq;
using Newtonsoft.Json;
using Raven.Client.Embedded;
using Raven.Client.Indexes;
@dlidstrom
dlidstrom / commandBuffer-es6.js
Last active Jan 16, 2017
Command buffer service for AngularJS used to manage asynchronous calls in a synchronized fashion.
View commandBuffer-es6.js
/**
* This service is used to serialize asynchronous events.
* It uses a buffering solution: http://ricostacruz.com/backbone-patterns/animation-buffer.html
* To use it, put your asynchronous actions (animations/ajax) inside an anonymous function
* to be passed into add().
* Be sure to trigger next() when done.
*
* Example:
* commandBuffer.add(next => {
* somePromise.done(next);
View gist:7153002
netsh http add urlacl url=http://+:8084/ user=ad-username
netsh http add urlacl url=http://127.0.0.1:8083/ user=ad-username