Skip to content

Instantly share code, notes, and snippets.

View srdjan's full-sized avatar

⊣˚∆˚⊢ srdjan

View GitHub Profile
@srdjan
srdjan / gist:4297273
Created December 15, 2012 17:11
using Simple.Data from F# for fun and...
open Simple.Data
open Xunit
open Swensen.Unquote
open ImpromptuInterface.FSharp
[<Fact>]
let ``Simple.Data data provider test`` () =
Database.UseMockAdapter(new InMemoryAdapter())
let db = Database.Open()
db?Test?Insert(dynArg(1) ? Id, dynArg("Alice") ? Name)
@srdjan
srdjan / gist:4313546
Created December 16, 2012 21:56
little bit of noise removed from c#...
using System
using System.Collections.Generic
using System.Data
using System.Data.SqlClient
using System.Linq
using Simple.Data.Ado
using Simple.Data.Ado.Schema
namespace Simple.Data.SqlServer
class SqlSchemaProvider : ISchemaProvider
@srdjan
srdjan / gist:4313558
Created December 16, 2012 21:58
let's start here... nicely written c# class...
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using Simple.Data.Ado;
using Simple.Data.Ado.Schema;
namespace Simple.Data.SqlServer
{
module BorrowABook =
type BookLoanProblem =
NotInCatalogue
| OutOnLoan
| InsufficientPermission
| Failed of string
type Book = Book
type BookModel = BookModel
using System;
using System.Linq;
using Raven.Abstractions.Data;
using Raven.Abstractions.Logging;
using Raven.Bundles.Replication.Plugins;
using Raven.Json.Linq;
namespace RavenConflictResolverPlugin
{
public class LastInWinsReplicationConflictResolver
@srdjan
srdjan / fun.cs
Last active August 29, 2015 14:01
using System;
using System.Collections.Generic;
namespace ConsoleApplication1 {
class Program {
static void Main() {
//-- define an Action that will perfom a query
Action<List<string>> query = r => r.AddRange(QuerySomething());
//-- invoke it and show results ;)
@srdjan
srdjan / func-overload.js
Created June 19, 2014 16:35
javascript function overloading...
var get = (function() {
var overrides = {
getAll: function() {
console.log('return all...');
return this;
},
getById: function(args) {
console.log('return by id:' + args);
return this;
},
getAll();
getById(5);
getByExpr('id > 5');
@srdjan
srdjan / api-with-overloads.js
Created June 19, 2014 16:39
api with overloads
get();
get(5);
get('id > 5');
namespace Simplr.Middleware {
public class ResourceResolver : MiddlewareBase {
public override Task Process(IContext context) {...}
}
public class HypermediaValidator : MiddlewareBase {
public override Task Process(IContext context) {...}
}
//...
//additional middleware components
}