Skip to content

Instantly share code, notes, and snippets.

View mariomeyrelles's full-sized avatar

Mario Meyrelles mariomeyrelles

  • São Paulo, Brazil
View GitHub Profile
@panesofglass
panesofglass / TcpServer.fsx
Created January 4, 2011 17:43
Asynchronous TCP server in F#
// [snippet: Async socket server using F# async computations.]
open System
open System.IO
open System.Net
open System.Net.Sockets
open System.Threading
type Socket with
member socket.AsyncAccept() = Async.FromBeginEnd(socket.BeginAccept, socket.EndAccept)
@acgetchell
acgetchell / type_of.fs
Last active August 8, 2016 22:51
Uses reflection provided by F# in the FSharpType namespace to translate a given System.Type object into a value of the 'a ty union type defined by https://gist.github.com/926994. From Jon Harrop's "Visual F# 2010 for Technical Computing"
let rec type_of f = function
| ty when Reflection.FSharpType.IsFunction ty ->
let ty_arg, ty_ret = Reflection.FSharpType.GetFunctionElements ty
Function(type_of f ty_arg, type_of f ty_ret)
| ty when Reflection.FSharpType.IsTuple ty ->
Tuple
[ for ty in Reflection.FSharpType.GetTupleElements ty do
yield type_of f ty ]
| ty when Reflection.FSharpType.IsRecord ty ->
Record( ty.Name,
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@theburningmonk
theburningmonk / FSharpSerialization.fsx
Created March 18, 2012 12:54
Serializing/Deserializing F# Record and DU types
#r "System.Xml.dll"
#r "System.Runtime.Serialization.dll"
open Microsoft.FSharp.Reflection
open System.IO
open System.Reflection
open System.Runtime.Serialization
open System.Runtime.Serialization.Formatters.Binary
open System.Runtime.Serialization.Json
open System.Text
@jamesmanning
jamesmanning / Program.cs
Created May 6, 2012 12:32
simple TCP client and server
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
class Program
@ldaniel
ldaniel / _aviso.md
Created May 16, 2012 12:18
Crítica à comunidade .NET

Aviso importante

"Às vezes, um charuto é apenas um charuto."

Não almejamos mais seguidores no Twitter, leitores para o blog ou amigos no Facebook. Somos, assumidamente (e com discreto orgulho), pessoas pouco sociáveis. Sim, esta crítica é, nesse caso, apenas uma crítica.

@leandronet e @mantov

@jonathanconway
jonathanconway / TypeExtensions.IsSimpleType.cs
Created August 12, 2012 08:09
Determine whether a type is simple.
public static class TypeExtensions
{
/// <summary>
/// Determine whether a type is simple (String, Decimal, DateTime, etc)
/// or complex (i.e. custom class with public properties and methods).
/// </summary>
/// <see cref="http://stackoverflow.com/questions/2442534/how-to-test-if-type-is-primitive"/>
public static bool IsSimpleType(
this Type type)
{
@SzymonPobiega
SzymonPobiega / gist:5220595
Last active April 25, 2024 17:19
DDD/CQRS/ES/Architecture videos

If you have two days to learn the very basics of modelling, Domain-Driven Design, CQRS and Event Sourcing, here's what you should do:

In the evenings read the [Domain-Driven Design Quickly Minibook]{http://www.infoq.com/minibooks/domain-driven-design-quickly}. During the day watch following great videos (in this order):

  1. Eric Evans' [What I've learned about DDD since the book]{http://www.infoq.com/presentations/ddd-eric-evans}
  2. Eric Evans' [Strategic Design - Responsibility Traps]{http://www.infoq.com/presentations/design-strategic-eric-evans}
  3. Udi Dahan's [Avoid a Failed SOA: Business & Autonomous Components to the Rescue]{http://www.infoq.com/presentations/SOA-Business-Autonomous-Components}
  4. Udi Dahan's [Command-Query Responsibility Segregation]{http://www.infoq.com/presentations/Command-Query-Responsibility-Segregation}
  5. Greg Young's [Unshackle Your Domain]{http://www.infoq.com/presentations/greg-young-unshackle-qcon08}
  6. Eric Evans' [Acknowledging CAP at the Root -- in the Domain Model]{ht
@cskardon
cskardon / neo4j-fsharp-basics.fs
Last active December 18, 2021 16:26
Basic usage of Neo4j from F# (http://geekswithblogs.net/cskardon/archive/2013/11/27/using-neo4j-with-f-ndash-cypher-2.0.aspx) Check the URL for your local Neo4j server!
open System
open Neo4jClient
open System.Linq
[<CLIMutable>]
type Person = { Name:string; Twitter:string }
[<CLIMutable>]
type Knows = { How:string }
@staltz
staltz / introrx.md
Last active June 26, 2024 10:24
The introduction to Reactive Programming you've been missing