Skip to content

Instantly share code, notes, and snippets.

View seankearon's full-sized avatar
💭
coding up a storm!

seankearon

💭
coding up a storm!
View GitHub Profile
Deployment steps for this blog post:
http://kearon.blogspot.co.uk/2015/01/installing-service-using-topshelf-with.html
@seankearon
seankearon / Typescript Jasmine Knockout Setup
Last active August 29, 2015 14:05
Set up for testing a TypeScript Knockout model in Visual Studio with Jasmine
Install-Package knockoutjs
Install-Package knockout.typescript.DefinitelyTyped
Install-Package JasmineTest
Install-Package jasmine.typescript.DefinitelyTyped
@seankearon
seankearon / get-script-folder.ps1
Last active August 29, 2015 14:03
ps: useful snippets
# Get the script's folder
function get_script_directory # http://blogs.msdn.com/b/powershell/archive/2007/06/19/get-scriptdirectory.aspx
{
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
Split-Path $Invocation.MyCommand.Path
}
$scriptpath = get_script_directory
cd $scriptpath
# Pause for user to press a key
@seankearon
seankearon / original-code-for-review.fs
Last active August 29, 2015 14:03
Parsing sections from a log file using F#
// Code for review posted here: http://codereview.stackexchange.com/questions/55554/parsing-sections-from-a-log-file-using-f
// Here are the "lines" from my "log file".
let lines = [1 .. 25] |> List.map (fun x -> x.ToString())
// For this exercise, section criteria is divisibility by 5.
// val DivisibleByFive : s:string -> bool
let DivisibleByFive (s:string) =
System.Int32.Parse(s) % 5 = 0
void Main()
{
var file = @"C:\Users\Me\Desktop\Certificates.txt";
var a = JObject.Parse(File.ReadAllText(file));
var cert = a["Certificates"][0];
// Get the UIDs for the existing boards and circuits.
var boards = cert["Boards"].Select (x => (Guid)x["UniqueId"]).ToArray();
var circuits = cert["Boards"].SelectMany (x => x["Circuits"]).Select (x => (Guid)x["UniqueId"]).ToArray();
@seankearon
seankearon / gist:2638423
Created May 8, 2012 18:47
Tobi's Embedded RavenDB Dumper with Attachments
// Based on original by Tobi: https://gist.github.com/617852830394aaaa7160
public class RavenDBDumper
{
#region Static Methods
private static void Read(JsonReader jsonReader, string arrayName, Action<RavenJToken> process)
{
if (jsonReader.Read() == false)
return;
if (jsonReader.TokenType != JsonToken.PropertyName)