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
//Serialised, asynchronous access to data structures | |
public class Agent<T> | |
{ | |
private readonly T m_data; | |
private readonly BlockingCollection<Action<T>> m_actions = new BlockingCollection<Action<T>>( new ConcurrentQueue<Action<T>>() ); | |
public Agent( T data ) | |
{ | |
if( data == null ) |
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
using System; | |
using System.Diagnostics; | |
using MongoDB.Driver; | |
namespace MongoDbLogging | |
{ | |
class Program | |
{ | |
private static bool g_logCalls; |
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
using System; | |
using System.IO; | |
using System.Text; | |
using System.Text.RegularExpressions; | |
//From http://trycatch.me/automatically-update-the-assemblyfileversion-attribute-of-a-net-assembly/ but starting powershell for each build was too slow. | |
//Pass the C# project path as the only parameter | |
public class Updater | |
{ | |
public static void Main( string[] args ) |
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
using System; | |
using System.IO; | |
using System.Text; | |
using System.Text.RegularExpressions; | |
// Convert a C# windows soltion so that it can easily be built on mono. I've found this easier than trying to get a single solution working on both | |
// This script will | |
// 1) Create a .mono.sln from the sln | |
// 1.1) Change the file version from 12 to 11 for MonoDevelop | |
// 1.2) Change all project includes from .csproj to .mono.csproj |
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
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<PropertyGroup> | |
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir> | |
<!-- Enable the restore command to run before builds --> | |
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages> | |
<!-- Property that enables building a package from a project --> | |
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage> |
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 class Data | |
{ | |
public ObjectId Id { get; set; } | |
public string Value { get; set; } | |
} | |
static void Main( string[] args ) | |
{ | |
var client = new MongoClient( "mongodb://localhost:27017" ); | |
var server = client.GetServer(); |
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
open System | |
open System.IO | |
open System.Text | |
open System.Globalization | |
open System.Text.RegularExpressions | |
let ttlTrue = 2.3 | |
let getLines (fname:string) = seq{ | |
use stream = new StreamReader( fname ) |
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
open System | |
open System.IO | |
open System.Text | |
open System.Globalization | |
open System.Text.RegularExpressions | |
let l1 = 1.0 | |
let l2 = 2.0 | |
let ttlTrue = 2.3 |
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
;;package sources | |
(load "package") | |
(package-initialize) | |
(add-to-list 'package-archives | |
'("marmalade" . "http://marmalade-repo.org/packages/")) | |
(add-to-list 'package-archives | |
'("melpa" . "http://melpa.milkbox.net/packages/") t) | |
(add-to-list 'package-archives | |
'("gnu" . "http://elpa.gnu.org/packages/") t) | |
(add-to-list 'package-archives |
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
open System | |
type PersonAge = PersonAge of int | |
type Person = { id: Guid; name: string; age: PersonAge} | |
let bjorn = { id=System.Guid.NewGuid(); name="Bjørn Einar"; age=PersonAge 34} | |
let changedName = {bjorn with name ="Bjørn the confused"} | |
let createAge age = |
OlderNewer