Skip to content

Instantly share code, notes, and snippets.

@thinktainer
thinktainer / obs.fs
Created February 4, 2015 16:54
Create an observable from an IEvent
Observable.createWithDisposable (fun observer -> Observable.subscribeObserver observer eventAggregate)
@thinktainer
thinktainer / show-networks.sh
Created February 2, 2015 09:27
vmware networks file
cat /Library/Preferences/VMware\ Fusion/networking
@thinktainer
thinktainer / .bash_profile
Created January 22, 2015 10:43
ssh-agent bash_profile
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add;
}
@thinktainer
thinktainer / getPropertyName.fsx
Created November 12, 2014 12:12
getPropertyName
open Microsoft.FSharp.Quotations.Patterns
let rec propertyName quotation =
match quotation with
| PropertyGet (_,propertyInfo,_) -> propertyInfo.Name
| Lambda (_,expr) -> propertyName expr
| _ -> ""
let myPropertyName = propertyName <@ fun (x : myClass) -> x.MyProperty @>
@thinktainer
thinktainer / introrx.md
Last active August 29, 2015 14:08 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@thinktainer
thinktainer / init.yml
Last active August 29, 2015 14:08 — forked from renoirb/init.yml
#
# How to install automatically Oracle Java 7 under Salt Stack
#
# Thanks Oracle for complicating things :(
#
# 1. Create a java/ folder in your salt master
# 2. Paste this file in init.sls
# 3. salt '*' state.sls java
#
# Source:
@thinktainer
thinktainer / dyingagent.fs
Last active August 29, 2015 14:06
an agent that dies
type EventPublisher (eventBus, logger) =
let agent eventBus (logger : ILoggingService) =
new Agent<EventAggregateMessage>(
fun inbox ->
let rec loop () = async {
let! message = inbox.Receive()
match message with
| EventAggregate aggregate ->
try
let playerId = aggregate.PlayerScope.PlayerId.ToString()
@thinktainer
thinktainer / odbc_config
Created September 19, 2014 20:46
missing odbc_config on ubuntu 14.04
#! /bin/sh
# This shell script saves various pieces of information about the
# installed version of unixODBC. Packages that interface to
# unixODBC can use it to configure their build.
# This file replaces the standard odbc_config, which is not
# relocatable
#
# Author: Alberto Di Meglio <alberto.di.meglio@cern.ch>
# Public domain