Skip to content

Instantly share code, notes, and snippets.

View schuster-rainer's full-sized avatar

Rainer Schuster schuster-rainer

View GitHub Profile
; A CLR port of http://bestinclass.wordpress.com/2009/09/24/chaos-theory-vs-clojure/
; Updated to use Rich Hickey's changes: http://paste.lisp.org/display/87799
;
; A WPF app is fired up in another thread. Anything you type in the REPL
; is dispatched to the WPF thread and evaluated there.
;
; Requires the following addition to ClojureCLR's GenDelegate.cs:
; public static Delegate CreateFunc(IFn fn)
; {
; Type delegateType = typeof(Func<>).MakeGenericType(new Type[] { typeof(object) });
@gf3
gf3 / gist:469685
Created July 9, 2010 16:31
Function#bind for V8/node
/**
* Function#bind(context [, arg1 [, arg2 [, argN]]]) -> Function
* - context (Object): Object context to bind to.
* - arg1 (?): Optional argument to curry.
*
* Bind a function to a given `context`. Optionally curry arguments.
*
* ### Examples
*
* var new_func = my_func.bind(my_object, "no u");
@jschementi
jschementi / bar.rb
Created July 19, 2010 08:25
MIX10, Part 2.2 & 3
foo_module = IronRuby.require 'foo'
foo_module.Foo.new.bar
module ComMonad
//type ComOp<'T> = (unit -> 'T)
let private runCom t = t()
type Com =
static member Run t = runCom t
let private result t = (fun () -> t)
let private delay (f:unit->unit->'a) = (fun() -> f()())
@forki
forki / gist:1147375
Created August 15, 2011 18:30
The DistributionMonad in F#
type 'a Outcome = {
Value: 'a
Probability : BigRational }
type 'a Distribution = 'a Outcome seq
// P(A AND B) = P(A | B) * P(B)
let bindD (dist:'a Distribution) (f: 'a -> 'b Distribution) =
dist
|> Seq.map (fun p1 ->
@jedie
jedie / python_test.py
Created September 1, 2011 16:51
Detect web handler: mod_wsgi, fast_CGI, mod_python or CGI and display many informations
#!/usr/bin/env python
# coding: utf-8
"""
Python web handler test
~~~~~~~~~~~~~~~~~~~~~~~
Detect web handler: mod_wsgi, fast_CGI, mod_python or CGI and display many informations
You should check if the shebang is ok for your environment!
@hodzanassredin
hodzanassredin / FileSystemTypeProvider.fs
Created September 25, 2011 19:57
Sample of file system TypeProvider
namespace FilesTypeProvider
open System.Reflection
open Microsoft.FSharp.Core.CompilerServices
open Samples.FSharpPreviewRelease2011.ProvidedTypes
open System.Text.RegularExpressions
[<TypeProvider>]
type public CheckedFilesProvider() as this =
@robertlj
robertlj / gist:3552582
Created August 31, 2012 13:20
CLojureCLR command line build Mono Win7/Win8 (4.0 Profile)
xbuild build.proj /target:Test /property:Configuration="Debug 4.0";Platform="Any CPU"
xbuild build.proj /target:Build /property:Configuration="Debug 4.0";Platform="Any CPU"
xbuild build.proj /target:Dist /property:Configuration="Debug 4.0";Platform="Any CPU"
xbuild build.proj /target:Test /property:Configuration="Release 4.0";Platform="Any CPU"
xbuild build.proj /target:Build /property:Configuration="Release 4.0";Platform="Any CPU"
@AndrewNewcomb
AndrewNewcomb / WebSocketServer.fs
Last active January 9, 2017 18:58
OLD from 2010 ... Updated example of using F# MailboxProcessor against an HTML5 WebSocket (in Google Chrome)
// Example of using F# MailboxProcessor against an HTML5 WebSocket (in Google Chrome)
// taken from http://v2matveev.blogspot.com/2010/04/mailboxprocessors-practical-application.html
// and then modified to work with the revised WebSocket protocol that includes a set of challenge bytes.
// The main changes are in the handshake function.
// Have a look at the http://nugget.codeplex.com for example WebSocket code in C#, on which I based the
// challenge processing code.
open System
open System.IO
open System.Linq
@zdam
zdam / clojure-clr-webserver.cs
Created February 28, 2010 00:00
Use clojureCLR inside an asp.net MVC app
/*
* This is a litle tech demo to demonstrate using clojureCLR in a CLR web app.
*
* A custom IHttpHandler (ClojureHttpHandler) handles invocation of clojure code,
* and a custom IRouteHandler (ClojureRouteHandler) routes requests to the HttpHandler.
*
* See comments in the code for further detail.
*
* Cheers, zdam
* http://zimpler.com/blog/clojureclr-in-an-asp-net-mvc-app