Skip to content

Instantly share code, notes, and snippets.

@ctaggart
ctaggart / EdgeJs.FSharp.fs
Last active August 29, 2015 14:02
edge.js
[<AutoOpen>]
module EdgeJs.FSharp
open System
open System.Threading.Tasks
type Async with
static member Box (r:Async<'TResult>) =
async {
let! o = r
@ctaggart
ctaggart / TsAst.app.ts
Created June 4, 2014 04:25
TypeScript AST from Node.js
///<reference path='typescriptServices.d.ts' />
// causes IntelliSense to partially work
// needed by Node.js at runtime, but comment out to use IntelliSense
var TypeScript = require('./typescriptServices');
// node.d.ts redefines require(), so must be below above statement
///<reference path='node.d.ts' />
import fs = require('fs');
import path = require('path');
@ctaggart
ctaggart / PrintVersions.fsx
Created June 8, 2014 19:42
print the assembly version attributes for each dll
open System
open System.IO
open System.Reflection
Directory.GetFiles(".","*.dll",SearchOption.TopDirectoryOnly) |> Seq.iter (fun f ->
printfn "%s" f
let a = Assembly.LoadFrom f
match a.GetCustomAttribute<AssemblyVersionAttribute>() with
| null -> ()
@ctaggart
ctaggart / RemoveConfigs.fs
Created June 10, 2014 15:52
Uses SLNTools & MSBuild to remove unnecessary Solution Configurations
module RemoveConfigs.App
open System
open System.Collections.Generic
open System.Text.RegularExpressions
// reference Microsoft.Build that requires Microsoft.Build.Framework
open Microsoft.Build.Construction
open Microsoft.Build.Evaluation
using ProtoBuf;
using System.IO;
namespace Riak
{
[ProtoContract]
public sealed class RpbErrorResp
{
public byte[] errmsg { get; set; }
public uint errcode { get; set; }
@ctaggart
ctaggart / XamarinCompleteGraph.fs
Created July 23, 2014 04:54
Xamarin F# Android Complete Graph
namespace BareMin
open System
open Android.App
open Android.Views
open Android.Graphics
// my phone has a Canvas of 480 x 690
// (0,0) is the upper left hand corner
@ctaggart
ctaggart / ReadWriteRpm.fs
Last active August 29, 2015 14:04
read rpm
let cs s = java.lang.CharSequence.op_Implicit s
type org.redline_rpm.header.Format with
member x.Lead with get() = x.getLead()
member x.Signature with get() = x.getSignature()
member x.Header with get() = x.getHeader()
type org.redline_rpm.header.Header.HeaderTag with
member x.Name with get() = x.getName()
@ctaggart
ctaggart / build.gradle
Created August 6, 2014 13:37
jdeb .net
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
compile('org.vafer:jdeb:1.3'){
exclude module: 'maven-core'
exclude module: 'maven-plugin-api'
@ctaggart
ctaggart / XmenCore.fsproj
Created September 29, 2014 15:31
add support for .NET Portable Subset #180 https://github.com/fsprojects/Paket/issues/180
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>a5726914-661b-4f63-afe5-c6a07df2e33a</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Xmen.Core</RootNamespace>
@ctaggart
ctaggart / paket.targets
Created September 29, 2014 15:55
paket.targets using MSBuildThisFileDirectory https://github.com/fsprojects/Paket/issues/172
<?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)' == '' ">true</RestorePackages>
<!-- Download Paket.exe if it does not already exist -->
<DownloadPaket Condition=" '$(DownloadPaket)' == '' ">true</DownloadPaket>