Skip to content

Instantly share code, notes, and snippets.

View mahizsas's full-sized avatar

MAHIZ mahizsas

View GitHub Profile
@mahizsas
mahizsas / PdfFilter.cs
Last active August 29, 2015 14:07 — forked from jbogard/PdfFilter.cs
public class PdfFilter : Stream
{
private readonly Stream _oldFilter;
private readonly string _baseUrl;
private readonly MemoryStream _memStream;
public override bool CanSeek
{
get { return false; }
}
@mahizsas
mahizsas / routes.js
Last active August 29, 2015 14:08 — forked from charandas/routes.js
app.config(function($stateProvider, BaseSettingsService, PrintSettingsService) {
$stateProvider
// All app states loaded in index.html
.state('app', {
abstract: true,
templateUrl: 'views/app.html',
controller: 'AppCtrl',
resolve: {
baseSettings: settings: function(BaseSettingsService) {
@mahizsas
mahizsas / web.config
Last active August 29, 2015 14:08 — forked from wullemsb/web.config
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="X-UA-Compatible" value="IE=Edge" />
</customHeaders>
</httpProtocol>
<system.webServer>
@mahizsas
mahizsas / DatabaseServerStatusController.cs
Last active August 29, 2015 14:08 — forked from darrelmiller/gist:972f01aa64c6e5df37df
DatabaseServerStatusController
using System;
using System.Data;
using System.Data.SqlClient;
using System.Net;
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http;
using Newtonsoft.Json.Linq;
@mahizsas
mahizsas / ConsoleRequestLogger.cs
Last active August 29, 2015 14:08 — forked from darrelmiller/gist:28221417620db2973a25
Colored Console MesageHanlder
public class ConsoleRequestLogger : DelegatingHandler
{
protected async override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("> {0} {1}",request.Method,request.RequestUri.GetComponents(UriComponents.PathAndQuery, UriFormat.SafeUnescaped));
ProcessHeader(request.Headers, (name, value) => Console.WriteLine("> {0}: {1}", name, value));
if (request.Content != null)
{
/**
* Perform a deeply recursive reduce on a set of JSON, or a JSON-encodable Object hierarchy.
*
* @param {Array|Object} collection
* @param {Function} fn
* @param {*} memo
* @return {*}
*/
function deepReduce(collection, fn, memo) {
@mahizsas
mahizsas / mongo_dynamic.cs
Last active September 22, 2024 23:43
Serilize dynamic data with mongodb
using System;
using System.Collections;
using System.Linq;
using MongoDB.Bson;
using MongoDB.Bson.IO;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Bson.Serialization.Options;
using MongoDB.Driver;
using MongoDB.Driver.Linq;
$/
  docs/
  src/
  tests/
  samples/
  artifacts/
  packages/
  build/
 lib/
@mahizsas
mahizsas / AppContext.cs
Last active August 29, 2015 14:11
Mapping private properties with EF via conventions
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Linq;
using System.Reflection;
namespace ConsoleApplication1.Model
{
Dropping Database.
Rebuild Database with latest Schema.
Load basic test environment data.
Loading basic account data.
Opening outer Transaction scope
Executing test 1.
Executing test 2.
Roll back transaction scope.