Skip to content

Instantly share code, notes, and snippets.

View satish860's full-sized avatar
🎯
Focusing

satish satish860

🎯
Focusing
View GitHub Profile
@satish860
satish860 / SequenceGenerator.cs
Created August 21, 2012 17:30
3n+1 Sequence
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SequenceGenerator
{
public class SequenceGenerator
{
@satish860
satish860 / gist:3635254
Created September 5, 2012 11:23 — forked from benfoster/gist:3635064
Testing route generation
var config = new HttpConfiguration();
config.Routes.MapHttpRoute("Foo", "foo/{id}", new { controller = "foo" });
config.Routes.MapHttpRoute("Bar", "bar/{id}", new { controller = "bar" });
var requestMessage = new HttpRequestMessage(HttpMethod.Get, "/");
requestMessage .Properties[HttpPropertyKeys.HttpConfigurationKey] = config ;
var vp = config.Routes.GetVirtualPath(requestMessage, "Foo" , new Dictionary<string,object> { { "controller", "foo" }, { "id", 10 } });
Console.WriteLine(vp);
@satish860
satish860 / ControllerRegistry.cs
Created September 21, 2012 10:15
Controller Registry for Webapi
using System.Web.Http.Controllers;
using DependencyResolver.Controllers;
using Raven.Client;
using Raven.Client.Embedded;
using StructureMap.Configuration.DSL;
namespace DependencyResolver
{
public class ControllerRegistry : Registry
{
@satish860
satish860 / DependencyResolverOLD.cs
Created September 22, 2012 15:14
MVC 3 Dependency Resolver
public class DependencyResolver : IDependencyResolver
{
private readonly IContainer container;
public DependencyResolver(IContainer container)
{
this.container = container;
}
public object GetService(Type serviceType)
{
@satish860
satish860 / BasicAuthenticationHandlerTest.cs
Created October 11, 2012 14:25
Basic authentication with HTTP and Webapi
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using WebAPIKoans.MessageHandlers;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
namespace WebAPIKoans.MessageHandlers
@satish860
satish860 / gist:3883452
Created October 13, 2012 06:08
Sample class
public class Customer
{
private string name;
private string email;
public Customer(string name,string email)
{
this.name=name;
this.email=email;
}
public void sendMail()
@satish860
satish860 / Instance.js
Created October 13, 2012 06:14
Javascript Class
var vistor = new customer("vistor", "vistor@gmail.com");
console.log(vistor.name) // this is not a private variable. ooch!!
/// <summary>
/// Url for the POST is http://localhost/api/todo
/// </summary>
/// <param name="item">Creates the Todo ITEM</param>
/// <returns></returns>
public HttpResponseMessage Post(TodoItem item)
{
try
{
if (string.IsNullOrEmpty(item.Description))
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace RuleComposer.Test
{
public class CustomerSpecification:SpecificationFor<Customer>
{
public CustomerSpecification()