Skip to content

Instantly share code, notes, and snippets.

View mahizsas's full-sized avatar

MAHIZ mahizsas

View GitHub Profile
@mahizsas
mahizsas / Global.asax.cs
Created April 6, 2016 06:54 — forked from elithompson/Global.asax.cs
Static resources, caching, and cache busting on AppHarbor
namespace Website
{
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Statics",
/*
* ASP.NET ActionFilterAttribute to help implement EU Cookie-law
* MIT Licence (c) Maarten Sikkema, Macaw Nederland BV
*/
using System;
using System.Web;
using System.Web.Mvc;
namespace Auction.Web.Utility
@mahizsas
mahizsas / Program.cs
Last active August 29, 2015 14:21 — forked from phatboyg/Program.cs
namespace ConsoleApplication2
{
using System;
using System.Threading;
using System.Threading.Tasks;
using Autofac;
using Fooidity;
using Topshelf;
using System;
using System.Collections.Generic;
using System.Timers;
using Topshelf;
namespace ConsoleApplication
{
public interface IProcess
{
void ProcessHandler(object o, ElapsedEventArgs args);
First, install grunt-cli in local project
> npm install grunt-cli
Then put following command in pre build event
cd $(SolutionDir)webapp\node_modules\.bin
grunt.cmd build
Note that "webapp" directory is just for my project, maske sure to put correct path for your case.
namespace LocalDBSample
{
using System;
using System.Data.SqlClient;
using System.IO;
using System.Reflection;
public class LocalDBHelper
{
public static string DataDirectory
/// <summary>
/// Converting the string value to T type
/// </summary>
/// <typeparam name="T">Type to convert string value to</typeparam>
/// <param name="value">String value to be converted to type T</param>
/// <returns>Returns converted string value to type T</returns>
public static T ConvertTo<T>(this string value) where T : IConvertible
{
var typeCode = default(T).GetTypeCode();
switch (typeCode)
Related Properties
- HttpRuntime.AppDomainAppVirtualPath
- Request.ApplicationPath
Methods for getting physical file path:
- System.Web.HttpContext.Current.Server.MapPath()
Methods for generating content URL:
@mahizsas
mahizsas / MongoDbProjectionWriter.cs
Last active August 29, 2015 14:17 — forked from gnschenker/MongoDbProjectionWriter.cs
MongoDb Projection Writer
using System;
using MongoDB.Bson;
using MongoDB.Driver;
using MongoDB.Driver.Builders;
namespace Recipes.ReadModel
{
public class MongoDbProjectionWriter<T> : IProjectionWriter<T>
where T: class
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using System.Data.Entity.SqlServer;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;