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
CREATE procedure [dbo].[db_restore](@Dbname nvarchar(200), @File nvarchar(max)) | |
AS | |
BEGIN | |
declare @sql nvarchar(max) | |
declare @rowsPath nvarchar(max) | |
declare @logPath nvarchar(max) | |
declare @dbRows nvarchar(255) | |
declare @dbLog nvarchar(255) | |
IF (SELECT COUNT(*) FROM sys.databases WHERE name = @Dbname) = 0 |
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
param( | |
[ValidateScript({Test-Path $_ -PathType 'Container'})] | |
[string]$path | |
) | |
Add-Type -AssemblyName System.Web | |
$files = ls -R -Path $path -Filter *.cs | |
$tasks = @() |
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
// Functional Friday - Introduction | |
// Mateusz Stasch <mstasch@future-processing.com> | |
// 2014.12.12 | |
// Links: | |
// http://fsharp.org | |
// http://tryfsharp.org | |
// http://fsharpforfunandprofit.com | |
// F# is a mature, open source, cross-platform, functional-first programming language |
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
let rec unzip3<'a, 'b, 'c> ((A: 'a list), (B: 'b list), (C: 'c list)) (tuples: (('a * 'b * 'c) list)) : ('a list) * ('b list) * ('c list) = | |
match tuples with | |
| (a: 'a, b: 'b, c: 'c)::tail -> unzip3 (a ++ A, b ++ B, c ++ C) tail | |
| [] -> (A, B, C) | |
let rec unzip3 (A, B, C) tuples = | |
match tuples with | |
| (a: 'a, b: 'b, c: 'c)::tail -> unzip3 (a :: A, b :: B, c :: C) tail | |
| [] -> (A, B, C) |
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
module kMeans | |
open NUnit.Framework | |
let distance = (fun a b -> abs(a - b)) | |
let avg = Seq.average | |
[<Test>] | |
let ``Should generate random subset`` () = | |
let data = seq [1..10] |
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
type Verbosity = Silent | Normal | Verbose | |
type Url = string | |
type Depth = int | |
let (|IsDepth|_|) str = | |
match System.Int32.TryParse(str) with | |
| (true, int) when int > 0 -> Some int | |
| _ -> None | |
let (|IsUrl|_|) url = |
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
type Cell = int * int | |
let exists_in element = | |
Seq.exists ((=) element) | |
let vicinity (x, y) = | |
seq { | |
for px in -1..1 do | |
for py in -1..1 do | |
yield (x+px, y+py) |
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
//*** | |
//*X* | |
//*** | |
let vicinity (cx, cy) = | |
seq { | |
for x in -1..1 do | |
for y in -1..1 do | |
yield (cx + x, cy + y) |
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
type Direction = | North | East | South | West | |
type Position = int * int | |
type Size = int * int | |
type Player = int | |
type World = { Taken : Position list; Heads : (Player * Position) list } | |
type Bot = Player -> Position -> World -> Direction | |
let skipLast list = | |
// TODO: Ultra inefficient |
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.Collections.Generic; | |
using System.Linq; | |
namespace MergeLinks | |
{ | |
public class Disjoint<T> | |
{ | |
private readonly Dictionary<int, HashSet<T>> _groups; | |
private int _lastGroupKey = 0; |
OlderNewer