Skip to content

Instantly share code, notes, and snippets.

View aruss's full-sized avatar
😎

Ruslan Akiev aruss

😎
  • Germany
View GitHub Profile
@aruss
aruss / UUIDGenerator.cs
Last active December 19, 2015 05:49
Kooboo UUIDGenerator with IoC
public interface IUUIDGenerator
{
string Generate(ContentBase content);
}
public class GuidUIIDGenerator : IUUIDGenerator
{
[DllImport("rpcrt4.dll", SetLastError = true)]
private static extern int UuidCreateSequential(out Guid guid);
@aruss
aruss / GuidGenerator.cs
Last active December 19, 2015 05:09
Sequential Guid Generator
using System;
using System.Runtime.InteropServices;
namespace eConduct.Extensions
{
public static class GuidGenerator
{
[DllImport("rpcrt4.dll", SetLastError = true)]
private static extern int UuidCreateSequential(out Guid guid);
public static class HumanNameGenerator
{
public enum Gender
{
Unknown = 0,
Male = 1,
Female = 2
}
private static readonly Random Rand = new Random((int)DateTime.Now.Ticks);
@aruss
aruss / CacheHelper.cs
Last active December 15, 2015 03:58
Cache Helper
public static class CacheHelper
{
public static string GetCachedResult(string key, Func<string> handle, int espiration = 86400)
{
var cache = HttpContext.Current.Cache;
var response = cache.Get(key);
if (response == null)
{
response = handle();