This file contains hidden or 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
#!/bin/bash | |
# Mac version | |
# Install Homebrew package manager: | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
brew update | |
# Install Node.js and npm | |
brew install node | |
npm install -g npm |
This file contains hidden or 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
#if INTERACTIVE | |
open System | |
open System.IO | |
Console.WriteLine "Downloading components, etc. Will take a while." | |
// Run as admin, developer command prompt or F# Interactive. e.g. "fsi myfile.fsx" | |
[<Literal>] | |
let connectionString = "Data Source=localhost; Initial Catalog=myDatabase; Integrated Security=True;" | |
let serverDir = __SOURCE_DIRECTORY__ + @"/frontend" |
This file contains hidden or 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
// This program will create packages.config files for each .csproj. | |
// It will enumerate your projects dll references to know the corresponding NuGet packages. | |
// packages.config files are used by Paket when converting from NuGet. | |
#if INTERACTIVE | |
#r "System.Xml.dll" //for scripts or interactive | |
#r "System.Xml.Linq.dll" //add reference if using F# as library | |
#else | |
module GeneratePaketConfigs | |
#endif |
This file contains hidden or 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 Console-application, then NuGet: Install-Package Akka | |
module AkkaConsoleApplication | |
open Akka | |
open Akka.Actor | |
type Greet(who) = | |
member x.Who = who | |
type GreetingActor() as g = | |
inherit ReceiveActor() |
This file contains hidden or 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.Net | |
open System.Reflection | |
let ``not in gac`` (filename:string) = | |
try | |
Assembly.Load filename |> ignore | |
false | |
with | :? IOException -> true |
This file contains hidden or 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
// Reduce / Aggregate / Fold | |
// Usual way makes deep recursion and trusts tail-opt: | |
// (a,b,c,d,e,f,g,h) => (((((((a + b) + c) + d) + e) + f) + g) + h) | |
// This more is quicksort-style parallel: | |
// (a,b,c,d,e,f,g,h) => (((a + b) + (c + d)) + ((e + f) + (g + h))) | |
// No Haskell Kinds support for F# so List and Array are easiest to make as separate methods. | |
open System.Threading.Tasks | |
module List = | |
let reduceParallel<'a> f (ie :'a list) = |
This file contains hidden or 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
// Put this file to your FunScript output folder. | |
var gulp = require('gulp'), | |
concat = require('gulp-concat'), | |
uglify = require('gulp-uglify'), | |
sourcemaps = require('gulp-sourcemaps'); | |
var jsfile = { | |
targetPath: '', | |
//This is your FunScript-generated .js-file: | |
sources: ['generated.js'] |
This file contains hidden or 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
/// (Infinite) list of note-frequency -pairs | |
let tones = | |
let bass = 55.0 | |
let octave = ["A"; "A#"; "B"; "C"; "C#"; "D"; "D#"; "E"; "F"; "F#"; "G"; "G#"] | |
let notes = seq { while true do yield! octave } | |
let frequency = bass |> Seq.unfold (fun x -> Some (x, x*System.Math.Pow(2.0, 1.0 / 12.0))) | |
Seq.zip notes frequency | |
//let ``guitar open A`` = tones |> Seq.nth 24 // val it : float * string = (220.0, "A") |
This file contains hidden or 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
// Microsoft Kinect Body Basics with Kinect SDK 2.0 and F# | |
#if INTERACTIVE | |
#r @"..\packages\Microsoft.Kinect.2.0.1410.19000\lib\net45\Microsoft.Kinect.dll" | |
#else | |
module Kinect20 | |
#endif | |
open Microsoft.Kinect | |
open System.Collections.Generic | |
let bodyFrameReader = |
This file contains hidden or 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
//From NuGet: Sparc.TagCloud | |
#if INTERACTIVE | |
#r @"..\packages\Sparc.TagCloud.0.0.1\lib\net40\Sparc.TagCloud.dll" | |
#else | |
module MyTagCloud | |
#endif | |
open System.IO | |
open Sparc.TagCloud | |
let analyzer = new TagCloudAnalyzer() |