Skip to content

Instantly share code, notes, and snippets.

View kshyju's full-sized avatar

Shyju Krishnankutty kshyju

View GitHub Profile
body
{
font-family: 'WOL_SB','Segoe UI Semibold','Segoe UI',Tahoma,Helvetica,sans-serif;
}
#tblAdd
{
margin:0 auto;
@kshyju
kshyju / renderpartialview
Created January 23, 2014 19:16
renderpartialview
protected string RenderPartialView(string viewName, object model, ViewDataDictionary dictionary = null)
{
if (string.IsNullOrEmpty(viewName))
viewName = this.ControllerContext.RouteData.GetRequiredString("action");
this.ViewData.Model = model;
if (dictionary != null)
{
foreach (var item in dictionary.Keys)
{
@kshyju
kshyju / unittest
Created January 24, 2014 21:45
Unit testing using Rhino
[Test]
public void Index_Action_Should_Return_BugsListVM_Object_With_Correct_Number_Of_Issues()
{
//IF the db has 2 issues of Location "SPRNT", the Index action should return 2 items in the Model/ViewModel
//Arrange
const int fakeTeamID = 1;
var _session = MockRepository.GenerateStrictMock<HttpSessionStateBase>();
@kshyju
kshyju / jQuery autocomplete
Created February 28, 2014 16:14
jQuery autocomplete load data from a custom object list via ajax
$("#txtSearch").autocomplete({
source: function (request, response) {
$.ajax({
url: "/Home/Getsrchresult",
type: "POST",
dataType: "json",
data: { term: request.term,location:$('#location').val() },
success: function (data) {
response($.map(data, function (item) {
return { label: item.srchresult+"-"+item.place, value: item.srchresult+"-"+item.place };
public class ValdationResult
{
public bool Status { Set;get;}
public List<string> Errors { set;get;}
}
@kshyju
kshyju / gist:11238354
Created April 24, 2014 01:25
generics with interface
public class KPIDataProcessor<T> : IDataProcessor<T>
{
public IEnumerable<T> Dtos { set; get; }
public void ProcessData()
{
Console.WriteLine("Processing KPI data");
}
}
public interface IDataProcessor<T>
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class Program
{
public static void Main()
{
@kshyju
kshyju / gist:11264331
Created April 24, 2014 18:20
Unity with generics
using System;
using Microsoft.Practices.Unity;
public class Program
{
public interface ILoader<IPoco>
{
string Name {get;}
}
@kshyju
kshyju / Nested-callback-hell
Created June 23, 2014 18:37
Nested ajax callbacks to make sure that we load look up data in all dropdowns before loading the page data.
//What is the alternative of getting rid of the nested callback hell ?
//Load the data for the 3 dropdowns
$http.get('Products/AllProducts/').success(function (data) {
$scope.products = data;
$http.get('Colors/AllColors/').success(function (colordata) {
$scope.colors = colordata;
$http.get('Products/AllSizes/').success(function (sizedata) {
Safari
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.2 Safari/605.1.15" = $15