Skip to content

Instantly share code, notes, and snippets.

@msarchet
msarchet / gist:4649919
Created January 27, 2013 19:26
Example For Dfowler
var TinyChat = TinyChat || {};
TinyChat.ConnectionID = '';
TinyChat.Connection = null;
TinyChat.Proxy = null;
TinyChat.StartChat = function () {
TinyChat.Connection = $.hubConnection();
TinyChat.Connection.logging = true;
@msarchet
msarchet / Example.cs
Created January 13, 2013 22:55
example
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
System.Diagnostics.Debugger.Launch();
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
@msarchet
msarchet / client.js
Created December 12, 2012 17:19
Functioning Array Call
$.connection.hub.start().done(function() {
$.connection.myHub.server.test(['1', '2', '3']);
});
@msarchet
msarchet / ManagedList.cs
Created December 4, 2012 17:56
A Quick Overview of a problem
public static class IRedisClientsManagerExtensions()
{
public static ManagedList<T> GetManagedList(this IRedisClientsManager manager, string key)
{
return new ManagedList<T>(manager, key);
}
}
public class ManagedList<T> : IList<T>
{
@msarchet
msarchet / APIExamples.cs
Created November 19, 2012 16:25
An abstraction over ServiceStacks IRedisList to provide cleaner connection handling
/*
** This exists to show differences in how to access HybridList<T> vs the standard IRedisList<T>
*/
//Adding items
//IRedisList<T>
using(var redis = new RedisClient())
@msarchet
msarchet / Users.cs
Created November 13, 2012 21:35
Trying to find a better way to do this
/*
I am using the cache here as a persistence layer, so I need to have a deterministic way at minimum
of knowing where to look for an object.
Problems that I already know exist: Currently I risk overwriting a list that has different items, perhaps I should only add and remove from teh Update section?
Thoughts better ways of handling the item changes from the time I fetch them from the cache until I read it from the cache.
Maybe instead of modifying the list I read out of the cache I should just send the update directly to the cache?
@msarchet
msarchet / quicktip.js
Created October 16, 2012 01:22
Quick Tooltip positioning start
function quicktip(options) {
var verticalPercent = '0';
var horizontalPercent = '0';
var stick = false;
if(options.verticalPercent !== undefined)
{
verticalPercent = options.verticalPercent;
}
@msarchet
msarchet / PosisitonIt.js
Created September 24, 2012 20:32
A Javascript Function to position one element around a different element
function positionIt($element, $anchorElement, verticalPercent, horizontalPercent)
{
if(!($localElement instanceof jQuery))
{
throw '$element must be a jQuery object';
return;
}
if(!($anchorElement instanceof jQuery))
{
@msarchet
msarchet / chosenhandler.js
Created June 9, 2012 17:05
Simple Chosen.js binding handler for knockoutjs
//knockout.js can be found at http://www.knockoutjs.com
//chosen.js can be found at http://harvesthq.github.com/chosen/
//jquery.js can be found at http://jquery.com
//Usage is data-bind="chosen: true"
//Want to clean this up to eventually work as
//data-bind="chosen: { options: SelectOptions, value: selectValue}"
ko.bindingHandlers.chosen = {
@msarchet
msarchet / Example4.html
Created May 9, 2012 16:39
Example 4 for the knockout talk
<!DOCTYPE html>
<script src="http://github.com/downloads/SteveSanderson/knockout/knockout-2.0.0.js"></script>
<script src="https://raw.github.com/bestiejs/lodash/master/lodash.js"></script>
<table >
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Phones</th>
</tr>
<tbody data-bind="foreach: contacts">