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
-- http://blog.jooq.org/2013/11/19/how-to-create-a-range-from-1-to-10-in-sql/ | |
IF EXISTS (SELECT * | |
FROM dbo.sysobjects | |
WHERE id = object_id (N'[dbo].[generate_series]') | |
AND OBJECTPROPERTY(id, N'IsTableFunction') = 1) | |
DROP FUNCTION [dbo].[generate_series] | |
GO | |
CREATE FUNCTION [dbo].[generate_series] ( @p_start INT, @p_end INT) |
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
// Learn more about F# at http://fsharp.org | |
open Microsoft.ML | |
open Microsoft.ML.Runtime.Api | |
open Microsoft.ML.Trainers | |
open Microsoft.ML.Transforms | |
open System | |
//The first four properties are inputs, the label is what you are predicting which is set in training | |
type IrisData() = | |
[<Column("0")>] [<DefaultValue>] |
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
open System.IO | |
#I @"/lib/mono/gtk-sharp-3.0" | |
#r "atk-sharp.dll" | |
#r "gio-sharp.dll" | |
#r "glib-sharp.dll" | |
#r "gtk-sharp.dll" | |
#r "gdk-sharp.dll" | |
module Tarot = | |
let mutable handSize = 5 | |
let shuffle a = |
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 memoize f = | |
let cache = ref Map.empty | |
fun x -> | |
match (!cache).TryFind(x) with | |
| Some res -> res | |
| None -> | |
let res = f x | |
cache := (!cache).Add(x,res) | |
res |
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
#r "WindowsBase" | |
#r "PresentationCore" | |
#r "PresentationFramework" | |
open System.Windows | |
open System.Windows.Controls | |
type Action = | |
| Increment |
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
// Convert from normal to web-safe, strip trailing "="s | |
function webSafe64(base64) { | |
return base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, ''); | |
} | |
// Convert from web-safe to normal, add trailing "="s | |
function normal64(base64) { | |
return base64.replace(/\-/g, '+').replace(/_/g, '/') + '=='.substring(0, (3*base64.length)%4); | |
} |
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
#r "WindowsBase" | |
#r "PresentationCore" | |
#r "PresentationFramework" | |
open System.Windows | |
open System.Windows.Controls | |
type Action = | |
| Increment |
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 Magma<'a> = | |
abstract member append : 'a -> 'a -> 'a | |
type Semigroup<'a> = | |
inherit Magma<'a> | |
type Monoid<'a> = | |
inherit Semigroup<'a> | |
abstract member empty : 'a |
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
// i ported that "fizzbuzz in tensorflow" to F# and Accord.Net's DeepBeliefNetwork | |
// http://joelgrus.com/2016/05/23/fizz-buzz-in-tensorflow/ | |
#r "Debug/Accord.dll" | |
#r "Debug/Accord.Math.dll" | |
#r "Debug/Accord.Neuro.dll" | |
#I "Debug" | |
open Accord.Neuro | |
open Accord.Neuro.Networks |
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
async.map(myUrls, function(url, callback) { | |
request(url, function(error, response, html) { | |
// Some processing is happening here before the callback is invoked | |
callback(error, html); | |
}); | |
}, function(err, results) { | |
... | |
}); |