Skip to content

Instantly share code, notes, and snippets.

View mahizsas's full-sized avatar

MAHIZ mahizsas

View GitHub Profile
@mahizsas
mahizsas / log-examples.txt
Created October 9, 2012 06:11 — forked from KevM/log-examples.txt
Adding the current web request URL to your log4net logging context
2012-10-04 17:25:25,241 DEBUG [|24] Dovetail.SDK.Bootstrap.Clarify.CurrentSDKUser / Setting the current user to be annie
2012-10-04 17:25:25,246 DEBUG [annie|24] Dovetail.SDK.Bootstrap.Clarify.ClarifySessionCache / Get session for annie. Found valid session in cache.
2012-10-04 17:25:39,695 DEBUG [|28] Dovetail.SDK.Bootstrap.Clarify.ClarifySessionCache /api/history/case/148 Getting application session.
2012-10-04 17:25:39,695 DEBUG [|28] Dovetail.SDK.Bootstrap.Clarify.ClarifySessionCache /api/history/case/148 Get session for sa. Found valid session in cache.
2012-10-04 17:25:39,695 DEBUG [|28] Dovetail.SDK.Bootstrap.Clarify.ClarifySessionCache /api/history/case/148 Get session for annie. Found valid session in cache.
2012-10-04 17:25:39,696 DEBUG [|28] Dovetail.SDK.Bootstrap.Authentication.PrincipalFactory /api/history/case/148 Creating principal for user annie with 165 permissions.
2012-10-04 17:25:39,696 DEBUG [|28] Dovetail.SDK.Bootstrap.Clarify.CurrentSDKUser /api/history/case/148 Setting the curren
@mahizsas
mahizsas / DatabaseDeleter.cs
Created October 24, 2012 20:12 — forked from jbogard/DatabaseDeleter.cs
Delete all tables in DB with NHibernate
public class DatabaseDeleter
{
private readonly ISessionFactory _configuration;
private static readonly string[] _ignoredTables = new[] { "sysdiagrams", "usd_AppliedDatabaseScript" };
private static string[] _tablesToDelete;
private static string _deleteSql;
private static object _lockObj = new object();
private static bool _initialized;
public DatabaseDeleter(ISessionFactory sessionSource)
@mahizsas
mahizsas / delete_tables_byprefix.sql
Created November 18, 2012 11:05 — forked from jasongaylord/delete_tables_byprefix.sql
TSQL - Delete Tables with a Prefix
declare @cmd varchar(4000)
declare cmds cursor for
Select 'drop table [' + Table_Name + ']'
From INFORMATION_SCHEMA.TABLES
Where Table_Name like 'prefix%'
open cmds
while 1=1
begin
@mahizsas
mahizsas / CsvActionResult.cs
Created November 24, 2012 16:51 — forked from simonech/CsvActionResult.cs
ActionResult for ASP.NET MVC that returns a CSV file from any list of objects
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Reflection;
using System.Text;
using System.Web;
using System.Web.Mvc;
namespace webnetconf.website.Helpers
@mahizsas
mahizsas / List-tables-as-wiki-markup.sql
Created November 30, 2012 00:17 — forked from colinangusmackay/List-tables-as-wiki-markup.sql
A T-SQL script that renders media wiki markup of a list of tables or views that can be used in the creation of a data dictionary. More details on my blog: http://colinmackay.co.uk/2012/06/14/creating-a-data-dictionary-with-sql-server-and-mediawiki-part-on
-- For more information about this script and its uses, visit:
-- http://colinmackay.co.uk/2012/06/14/creating-a-data-dictionary-with-sql-server-and-mediawiki-part-one-a-list-of-tables/
DECLARE @Type NVARCHAR(100) = 'BASE TABLE' -- 'VIEW' OR 'BASE TABLE'
DECLARE @catalogue SYSNAME;
DECLARE @schema SYSNAME;
DECLARE @name SYSNAME;
SET NOCOUNT ON
@mahizsas
mahizsas / vs2012-empty.sln
Last active October 14, 2015 00:28 — forked from lucamilan/gist:3841570
VS2012 Empty Solution File
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
/*
* Scripts to remove data you don't need here
*/
/*
* Now let's clean that DB up!
*/
DECLARE @DBName VarChar(25)
public class SomeClass {
public void SomeMethod() {
this.Log().Info(() => "Here is a log message with params which can be in Razor Views as well: '{0}'".FormatWith(typeof(SomeClass).Name));
}
}
@mahizsas
mahizsas / RouteConfig.cs
Created January 28, 2013 11:30 — forked from carolynvs/RouteConfig.cs
WebApi routing, that allow SOAP and REST style
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
// GET /api/{resource}/{action}
routes.MapHttpRoute(
name: "Web API RPC",
routeTemplate: "api/{controller}/{action}",
defaults: new { },
constraints: new { action = @"[A-Za-z]+", httpMethod = new HttpMethodConstraint("GET") }
@ECHO OFF
SETLOCAL
SET VERSION=%1
SET NUGET=buildsupport\nuget.exe
FOR %%G IN (packaging\nuget\*.nuspec) DO (
%NUGET% pack %%G -Version %VERSION% -Symbols -o artifacts
)