Skip to content

Instantly share code, notes, and snippets.

Avatar

Demis Bellot mythz

View GitHub Profile
@danielwertheim
danielwertheim / program.cs
Created January 9, 2012 21:22
ServiceStack struct fun
View program.cs
Content2 is represented as name in the Json, event if it's ToString returns null. Tried SerializeFn to.
@joshilewis
joshilewis / NHibernateUserAuthRepository.cs
Created March 8, 2012 12:50
NHibernate-based implementation of ServiceStack's IUserAuthRepository
View NHibernateUserAuthRepository.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Globalization;
using ServiceStack.ServiceInterface.Auth;
using ServiceStack.Common;
using NHibernate;
@manuelnelson
manuelnelson / AzureCacheClient.cs
Created May 28, 2012 20:00
Azure Cache Client With Service Stack
View AzureCacheClient.cs
using System;
using System.Collections.Generic;
using Elmah;
using Microsoft.ApplicationServer.Caching;
using ServiceStack.CacheAccess;
namespace BusinessLogic
{
public class AzureCacheClient : ICacheClient
{
@derFunk
derFunk / BinarySerializedTests.cs
Created August 30, 2012 16:56
Cached binary serialization unit tests for ServiceStack
View BinarySerializedTests.cs
using System;
using System.Text;
using NUnit.Framework;
using ServiceStack.Plugins.ProtoBuf;
using ServiceStack.ServiceClient.Web;
using ServiceStack.Text;
namespace ServiceStack.WebHost.IntegrationTests.Tests
{
[TestFixture]
@DevJohnC
DevJohnC / gist:3829524
Created October 3, 2012 20:08
Early RSA signing DTO
View gist:3829524
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using ServiceStack.Text;
namespace FragLabs.VOIP.Common.DTOs
{
/// <summary>
/// Base class for DTOs that must be securely signed using the RSA algorithm.
/// </summary>
@micahasmith
micahasmith / WagStackAsyncRepository.cs
Created October 5, 2012 01:29
TPL Async Db w/ ServiceStack and Insight.Database
View WagStackAsyncRepository.cs
/* WagStack
*
* TPL Async DAL using ServiceStack's Expression/SQL Building
* and Insight.Database's async features
*/
public class WagStackAsyncRepository<T>:IAsyncRepository<T>
{
static WagStackAsyncRepository()
@aaronblohowiak
aaronblohowiak / gist:3932768
Created October 22, 2012 17:23
RedisConf Notes Part I
View gist:3932768
Redisconf Notes:
"We will begin this morning with a performance"
"Is this a key store..." Bohemian Rhapsody Key/Value Store ballad. Epic Win!
"Any way the data flows doesn't really matter to me... flushdb..."
"Lua killed a db by writing after calling a nondeterministic function..."
"Got to leave SQL behind and face the truth..."
"Redis, I don't want to join, sometimes I wish I'd never described a query..."
"The ZSET has some data set aside for me, for me, for MEEEEEEE"
View BytesExtensions.cs
using System;
namespace RsaKeyConverter.Converter
{
public static class BytesExtensions
{
public static string ToBase64(this byte[] bytes)
{
return Convert.ToBase64String(bytes);
}
@bamboo
bamboo / ReactiveServiceStack.cs
Last active May 11, 2019 16:00
Using ServiceStack* together with Reactive Extensions** to reduce the latency before the client can start processing the elements of an array response. The service sends elements to the client as soon as they become available through the magic of AsyncServiceBase, IStreamWriter, IObservable<T>.ToEnumerable() and careful use of WriteLine() and Fl…
View ReactiveServiceStack.cs
using System;
using System.Collections.Generic;
using System.Disposables;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using Funq;
using ServiceStack.Common.Web;
using ServiceStack.Service;
@aaronlerch
aaronlerch / gist:5664860
Created May 28, 2013 18:15
ServiceStack self-host workaround for VirtualPathUtility exception. If you're self-hosting recent versions of ServiceStack (3.9.45+) and serving Razor views, you'll notice that @href (which is a wrapper around Url.Content) fails with app-relative paths that start with "~/". Add the following to your startup code to work around it.
View gist:5664860
var domain = Thread.GetDomain(); // or AppDomain.Current
domain.SetData(".appDomain", "yep");
domain.SetData(".appVPath", "/");
domain.SetData(".appPath", domain.BaseDirectory);
if (String.IsNullOrWhiteSpace(domain.GetData(".appId") as string))
{
domain.SetData(".appId", "1");
}
if (String.IsNullOrWhiteSpace(domain.GetData(".domainId") as string))
{