Skip to content

Instantly share code, notes, and snippets.

@dlidstrom
dlidstrom / github-starter.markdown
Created January 11, 2011 12:04
Komma igång med GitHub

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

@dlidstrom
dlidstrom / Specification.markdown
Created January 13, 2011 15:20
Specification

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(this, new Specification(second));

@dlidstrom
dlidstrom / Specification.cs
Created January 15, 2011 11:00
Specification design pattern
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 January 19, 2011 12:57
How to configure Castle Windsor with logging.
<?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}" />

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

@dlidstrom
dlidstrom / RavenIndexTest.cs
Created October 13, 2011 14:39
Raven indexing test
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 October 13, 2011 15:10
Raven indexing test (working)
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 January 16, 2017 08:03
Command buffer service for AngularJS used to manage asynchronous calls in a synchronized fashion.
/**
* 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);
@dlidstrom
dlidstrom / gist:7153002
Created October 25, 2013 11:07
MiniNode setup
netsh http add urlacl url=http://+:8084/ user=ad-username
netsh http add urlacl url=http://127.0.0.1:8083/ user=ad-username