Skip to content

Instantly share code, notes, and snippets.

<html>
<head>
<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
<style>
ul {
list-style-type: none;
}
</style>
</head>
<body>
using Castle.Windsor;
using NUnit.Framework;
namespace WindsorInitConfig {
[TestFixture]
public class NoResolutionTests {
public interface IServiceA {}
public class ServiceA: IServiceA {}
[TestFixture]
public class IIRFTests {
[Test]
[Factory("IIRFTestFactory")]
public void IIRFTest(string orig, string dest) {
File.WriteAllText(@"SampleUrls.txt", string.Format("{0}\t{1}", orig, dest));
var r = RunProcess(@"TestDriver.exe", @"-d .");
if (r.ErrorLevel != 0) {
var actual = Regex.Replace(r.Output.Replace("\r\n", " "), @".*actual\((.*)\).*", "$1");
Assert.AreEqual(dest, actual);
open System
open System.IO
let enumFiles = Seq.collect (fun p -> Directory.EnumerateFiles(".", p, SearchOption.AllDirectories))
let procFile f =
printfn "%s" f
let lines = File.ReadLines f
|> Seq.map (fun l -> System.Text.RegularExpressions.Regex.Replace(l, "\r?\n", "\r\n"))
|> Seq.toArray
File.WriteAllLines(f, lines)
module SQL
open System
open System.Data
open System.Data.SqlClient
open System.Text.RegularExpressions
open Microsoft.FSharp.Reflection
open Xunit
let connectionString = "data source=.;user id=sa;password=a;initial catalog=SomeDatabase"
#r "CLSIClient.dll"
open CLSI
let token = "your_CLSI_token"
let compile = compile "http://clsi.scribtex.com/clsi/compile"
let req = Request.make(token = token, root = "tesis.tex", resources = [
R("tesis.bib", fromFile "tesis.bib")
R("tesis.tex", fromFile "tesis.tex")
R("logo_fiuba_alta.jpg", fromUrl "http://github.com/mausch/Figment/raw/master/logo_fiuba_alta.jpg")
module FSharp.Nullable
open System
open Microsoft.FSharp.Math
module Option =
let fromNullable (n: _ Nullable) =
if n.HasValue
then Some n.Value
else None
@mausch
mausch / hash.fsx
Created September 21, 2010 21:28
#r "FSharp.PowerPack"
open System
open System.IO
open System.Security.Cryptography
let hashFile f =
use fs = new FileStream(f, FileMode.Open)
use hashFunction = new SHA512Managed()
open System
open System.Net
open System.Net.Mail
open System.Threading
/// from http://msdn.microsoft.com/en-us/magazine/cc163467.aspx
type internal AsyncResultNoResult(callback: AsyncCallback, state: obj) =
let statePending = 0
let stateCompletedSync = 1
let stateCompletedAsync = 2
@mausch
mausch / git-shallow-submodule.sh
Created November 18, 2010 17:10
Shallow-cloned submodules in git
#!/bin/bash
# Idea from http://stackoverflow.com/questions/2144406/git-shallow-submodules
git submodule init
for i in $(git submodule | sed -e 's/.* //'); do
spath=$(git config -f .gitmodules --get submodule.$i.path)
surl=$(git config -f .gitmodules --get submodule.$i.url)
git clone --depth 1 $surl $spath
done
git submodule update