Skip to content

Instantly share code, notes, and snippets.

Disable-UAC
Set-ExplorerOptions -showHiddenFilesFoldersDrives
Enable-RemoteDesktop
Set-TaskbarSmall
cinst VisualStudio2013Ultimate
cinst Fiddler
cinst SublimeText2
cinst kdiff3
cinst Dropbox
@msarchet
msarchet / redis.md
Last active December 13, 2015 22:09
Overview for Redis Hangout

Redis Basics

  • How to get it running
  • Data Types
  • Using it in a development environment
  • Using it in a production environment

ServiceStack.Redis

  • Generic vs Non-Generic
@msarchet
msarchet / GenericLockedUpdates.cs
Last active October 16, 2017 17:37
Sometime you need to make sure that Redis is actually updating what you want to update
/*
Sometimes you need to just update something and assure that it happens
*/
public static class GenericReplaceLock
{
public static void UpdateListItem<T>(this IRedisClientsManager Manager, string key, T old, T newer)
{
using (var Client = Manager.GetClient())
using (var redis = Client.As<T>())
using (var transaction = redis.CreateTransaction())
@msarchet
msarchet / RetryRedisClient.cs
Created February 12, 2013 04:24
pseudo code for redis retry
public static TResult Retry(this IRedisClient client, Func<TResult> Retry)
{
try
{
return (TResult)Retry.Invoke();
}
catch(RedisException RedisException)
{
//Do Something Here To Wait
return (TResult)Retry.Invoke();
var oldUser = User;
User.UserStatus = (UserStatuses)Status;
var newUser = User;
using(var client = ClientManager.GetClient())
{
client.Replace<UserModel>(UsersKey, oldUser, newUser);
}
return User;
@msarchet
msarchet / Extensions.cs
Created February 7, 2013 04:17
Cleanly update an item in a ServiceStack.Redis.IRedisList<T>
/*
Sometimes you need to just udpate something and assure that it happens
*/
public static class GenericReplaceLock
{
public static void Replace<T>(this IRedisClient Client, string key, T old, T newer)
{
using (var redis = Client.As<T>())
using (var transaction = redis.CreateTransaction())
{
@msarchet
msarchet / Example.cs
Created February 1, 2013 16:06
Ghost Doc Example
/// <summary>
/// Joins the chat.
/// </summary>
/// <param name="UserName">Name of the user.</param>
/// <param name="authguid">The authguid.</param>
/// <exception cref="System.Exception">
/// Unable to find user
/// or
/// Unable to authorize user
/// </exception>
public async void CheckForRooms()
{
var getRooms = new Task<IList<RoomModel>>(() => { return _roomRepo.Rooms(); });
var Rooms = await getRooms;
var emptyRooms = new List<RoomModel>();
foreach (var room in Rooms)
{
if (_userRoomRepo.GetUsersForRoom(room.RoomName).Any())
{
emptyRooms.Add(room);
@msarchet
msarchet / Hub.cs
Created January 28, 2013 00:21
An Example of binding to a proxy later and adding a user to a group allowing a method on a proxy to be invoked
using Microsoft.AspNet.SignalR;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace noproxySignalR
{
//This is the code required for the hub
@msarchet
msarchet / Hub.cs
Last active December 11, 2015 19:39
This is the code required to reproduce a bug in SignalR where joining a Group will allow messges to be invoked on the server even if the hub is not conencted to
//This is the code required for the hub
public class TestHub :Hub
{
public void joinGroup()
{
Groups.Add(Context.ConnectionId, "base");
}
public void Send()